I have a Cache with cachestore , built by CacheJdbcPojoStoreFactory. The problem is: when I try to query cache, it seems that it only runs over memory(Read-Through is not applied in this case). I expect it to look if memory contains. If not, then it should query database(But also in that case, cache will never know that if all the data it needs locate on memory but maybe index can provide that fast).
Am I missing something or is this the behavior of it?
This is correct behavior. SQL queries don't do read-through, because read-through in a key-value storage is possible only by key, which is impossible with SQL where the set of required keys is unknown.
Having said that, you need to have all the data required for the query in memory prior to its execution. You can use
loadCache() method to bulk-load the data into the cache. See this page for details: https://apacheignite.readme.io/docs/data-loading#ignitecacheloadcache
Also GridGain is developing a new enterprise feature which will allow to achieve exactly what you describe, but with a proprietary underlying disk storage. This will still not be possible with an abstract persistent store, like a relational database.