PuszekSE opened a new issue, #11451:
URL: https://github.com/apache/ignite/issues/11451

   I've been looking into using Ignite as an automated Caching layer on top of 
existing database table and I've just realised that it requires you to 
_MANUALLY_ call [LoadData](https://github.com/apache/ignite/) after startup.
   
   The setup I'm looking into is pure helm/k8s deployment, so all the cache 
configurations, query entities, connections, etc. already exist and are 
operational, but it seems like it's impossible to configure it to automatically 
scrape the data from the datasource.
   
   From my understanding Ignite already operates on top of Spring, so it should 
be possible to include some basic cache initialisation capabilities.
   
   Very simple (autogenerated) piece of code that I would consider, is 
something like this?...
   (Obviously it requires modifications inside  related libraries, to actually 
properly pass the rest of configuration
   (In my case, mainly `cacheStoreFactory` configs, that already provide the 
information on how to actually load the cache)
   
   ```
   @Configuration
   @EnableScheduling
   public class CustomCacheConfiguration<K, V> extends CacheConfiguration<K, V> 
{
   
       @IgniteInstanceResource
       private Ignite ignite;
   
       private String cronExpression;
       private boolean initializeOnCreate;
   
       public CustomCacheConfiguration(String name, String cronExpression, 
boolean initializeOnCreate) {
           super(name);
           this.cronExpression = cronExpression;
           this.initializeOnCreate = initializeOnCreate;
       }
   
       @PostConstruct
       public void postConstruct() {
           if (initializeOnCreate) {
               initializeCache();
           }
       }
   
       @Scheduled(cron = "#{@customCacheConfiguration.cronExpression}")
       public void scheduledInitializeCache() {
           initializeCache();
       }
   
       public void initializeCache() {
           IgniteCache<K, V> cache = ignite.getOrCreateCache(this);
           cache.loadCache(null);
       }
   }
   ```
   
   I'm not sure whether it's desired feature, but I believe it's something that 
would greatly increase the usability of Ignite in somewhat basic scenarios, 
especially with current shift into full k8s-based environments.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to