And the code in main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java explains it all. Sorry for the noise.
I am not sure if applying this to the sql query is a possibility or if it even makes sense. I have to wrap my head around the way to implement it. Thanks, Ognen On Mon, Jun 29, 2015 at 5:09 PM, Ognen Duzlevski <[email protected]> wrote: > Ok, reading the javax spec - it would appear that CacheLoader load() only > gets invoked (automatically by the cache engine such as Ignite) only if the > data is not available in cache. > > " > * If the cache is configured to use read-through, and get would return null > * because the entry is missing from the cache, the Cache's {@link > CacheLoader} > * is called in an attempt to load the entry. > " > > Thanks! > > On Mon, Jun 29, 2015 at 3:32 PM, Ognen Duzlevski < > [email protected]> wrote: > >> Dmitriy, >> >> Thanks. Just so I understand: I am looking at the CacheStore example and >> the whole discussion on: >> http://apacheignite.readme.io/v1.1/docs/persistent-store >> >> In that example the load() method takes a key which is then used >> automatically to query the underlying SQL persistent store and the results >> are served back to client. >> >> How about this scenario? I get the key in the load method and I first >> check to see if my data is in cache. If it is, I serve the result from >> cache, otherwise I go to persistent storage. >> >> Is this handled automatically by Ignite in the background and that's why >> the load() method in the example pays no attention to the possibility of >> the key/value already existing in memory? Or is that something I have to >> explicitly check for in the load() implementation? >> >> Thanks! >> >> On Mon, Jun 29, 2015 at 2:53 PM, Dmitriy Setrakyan <[email protected] >> > wrote: >> >>> >>> On Mon, Jun 29, 2015 at 12:38 PM, Ognen Duzlevski < >>> [email protected]> wrote: >>> >>>> How about SQL queries on ignite? Do they end up being translated into >>>> series of gets() and hence make use of the read-through CacheStore >>>> implementation? >>>> >>> >>> The answer is No. Queries are executed only on the in-memory data. To >>> support what you are suggesting, we would have to execute a query on the >>> database, get all the keys back, and then execute a bunch of cache.get(..) >>> calls for each returned key. Overall, this would be very slow and that's >>> why was not done for Ignite. >>> >>> Having said that, we can enhance our Hibernate integration to support >>> this use case. I will file a ticket. >>> >>> D. >>> >>> >> >
