如何刷新简单的spring memcached中的所有缓存条目

时间:2013-07-17 08:58:56

标签: caching memcached distributed-caching distributed-cache simple-spring-memcached

这个问题是参考Simple Spring memcached。

我有一个场景,其中使用userId作为关键字为用户缓存交易列表。现在,如果交易数据更新,我需要为所有用户刷新缓存,因为这会影响所有用户的交易数据。 如何使用SSM注释实现此目的。 invalidate * cache和update * cache选项似乎无效/更新密钥特定的缓存条目,而我需要清除整个缓存。

1 个答案:

答案 0 :(得分:1)

目前在普通SSM中无法使用注释刷新整个缓存,如果您需要此选项,请在以下位置创建功能请求:https://code.google.com/p/simple-spring-memcached/issues/list

还有另一种方法可以使用SSM和Spring Cache作为描述符来刷新整个缓存:https://code.google.com/p/simple-spring-memcached/wiki/Getting_Started#Spring_3.1_Cache_Integration。 只需将allowClear更改为“true”并使用@CacheEvict(value = YOUR_CACHE_NAME, allEntries = true)

即可
相关问题