GemFire : CacheLoader : Getting data from external database

冷暖自知 提交于 2020-01-17 06:17:12

问题


cacheloader : Use case

One of main use case where GemFire is used is, where it is used as a fast running cache which holds most recent data (example last 1 month) and all remaining data sits in back-end database. I mean Gemfire data which is 1 month old is overflowed to database after 1 month. However when user is looking for data which was beyond 1 month, we need to go to the database and get the data. Cache loader is suitable for doing this operation on cache misses and gets data from the database. Regarding cache loader I beleive cache misses is triggered only when we do a Get operation on a key and if the key is missing.

What I do not understand is when the data gets overflowed to back-end, I beleieve no reference exist in Gemfire. Also a user may not know the Key - to do a get operation on Key, he might need to execute a OQL query on some other fields other than key. How will cache miss be triggered when I don't know the key?

Then how does Cache loader fits into the overall solution?


回答1:


Geode will not invoke a CacheLoader during a Query operation.

From the Geode documentation:

The loader is called on cache misses during get operations, and it populates the cache with the new entry value in addition to returning the value to the calling thread.

(Emphasis is my own)



来源:https://stackoverflow.com/questions/35059415/gemfire-cacheloader-getting-data-from-external-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!