Frage

I am using oracle coherence caching.

For configuring expiry, there is a parameter called 'expiry-delay' to configure the expiry in xml file.

I would like to know if it is possible to pass the expiry duration while adding the object into the cache.

Appreciate any help on this.

War es hilfreich?

Lösung

try to set TTL value when you put new item to the cache

Object put(Object oKey,
       Object oValue,
       long cMillis)

CacheMap JavaDoc

Andere Tipps

You can invoke the method put(Object oKey, Object oValue, long cMillis) on the NamedCache you hold. When calling this method, your entry will expire exactly after cMillis it is committed to the cache (and committed to the DB if you have persistency). By this way, Coherence will ignore the default value set in the scheme definition. If you wanna use anyway the default value, you can use CacheMap.EXPIRY_DEFAULT as value.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top