GemFire:CacheLoader:从外部数据库获取数据 [英] GemFire : CacheLoader : Getting data from external database

查看:125
本文介绍了GemFire:CacheLoader:从外部数据库获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cacheloader:用例

cacheloader : Use case

使用GemFire的主要用例之一是,它将GemFire用作快速运行的缓存,该缓存可保存最新数据(例如最近1个月的数据),而所有剩余数据都位于后端数据库中.我的意思是1个月前的Gemfire数据在1个月后溢出到数据库中. 但是,当用户寻找超过1个月的数据时,我们需要进入数据库并获取数据. 缓存加载器适用于在缓存未命中并从数据库获取数据时执行此操作.关于缓存加载器,只有当我们对某个键执行Get操作并且该键丢失时,才会触发我认为缓存未命中.

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.

我不明白的是,当数据溢出到后端时,我相信Gemfire中没有引用.另外,用户可能不知道Key-要对Key进行get操作,他可能需要在除key之外的其他某些字段上执行OQL查询. 当我不知道键时如何触发缓存未命中?

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?

那Cache loader如何适合整个解决方案?

Then how does Cache loader fits into the overall solution?

推荐答案

Geode在查询操作期间不会调用CacheLoader.

Geode will not invoke a CacheLoader during a Query operation.

Geode文档:

get操作期间缓存未命中时调用加载程序,除了将值返回给调用线程之外,它还使用新的条目值填充缓存.

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.

(强调是我自己的)

这篇关于GemFire:CacheLoader:从外部数据库获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆