キャッシュされた POJO のプロパティに基づいて、キャッシュ オブジェクトを期限切れ/削除するように指示する方法はありますか。
以下のコードでは、インスタンスをキャッシュしFoo
ます。Foo クラスにはexpiresIn
プロパティ class Foo { Date expiresIn;があります。}
expiresIn
キャッシュされた要素のプロパティの値に基づいて、キャッシュを期限切れにするようにスプリングをヒントしたいと思います。これは実現可能ですか?
@Cacheable("my-cache-key")
Foo getCachedToken(String userName, String password) throws AuthException
私のCache.xmlは以下の通りです:
<cache:annotation-driven/>
<bean id="cacheManager" class="org.springframework.cache.support.CompositeCacheManager">
<property name="cacheManagers">
<list>
<ref bean="mapCacheManager"/>
</list>
</property>
</bean>
<bean id="mapCacheManager" class="org.springframework.cache.concurrent.ConcurrentMapCacheManager">
<property name="cacheNames">
<list>
<value>my-cache-key</value>
</list>
</property>
</bean>