0

次のメソッド シグネチャがあります。

@Cacheable(value="keyValueCache",key="#key")
public KeyValuePair getKeyValuePair(String key);

ehcache.xml で次のキャッシュが定義されています。

   <cache name="keyValueCache" eternal="false"
    maxElementsInMemory="100" overflowToDisk="true" diskPersistent="false"
    timeToIdleSeconds="3600" timeToLiveSeconds="3600"
    memoryStoreEvictionPolicy="LRU" />           

ここで、次のメソッドで @CacheEvict を使用したいと思います。

    public KeyValuePair updateKeyValuePair(KeyValuePair keyValuePairs);

ここで、KeyValuePair には「キー」というフィールドがあるため、次のようなものを使用できます。

    @CacheEvict(value="keyValueCache", key="#keyValuePair.key")

問題は、メソッド引数として KeyValuePair のリストを取得する場合、@CacheEvict をどのように使用するかです。

    public KeyValuePair updateKeyValuePairs(List<KeyValuePair> keyValuePairs);
4

0 に答える 0