java.lang.Object
org.omnifaces.util.cache.TimeToLiveCache
- All Implemented Interfaces:
Serializable,Cache
- Direct Known Subclasses:
DefaultCache
Base class that can be used by Map based caches that don't support time to live semantics and arbitrary attributes natively.
- Since:
- 1.1
- Author:
- Arjan Tijms
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the entire cacheGets a value from the cachegetAttribute(String key, String name) Gets a named attribute from the cache entry identified by the key parameter.Gets a value from the cachevoidStores a value in the cachevoidStores a value in the cachevoidputAttribute(String key, String name, Serializable value, int timeToLive) Stores a named attribute in the cache entry identified by the key parameter.voidputObject(String key, Serializable value, int timeToLive) Stores a value in the cachevoidRemoves a value from the cacheprotected voidsetCacheStore(Map<String, CacheEntry> cacheStore)
-
Constructor Details
-
TimeToLiveCache
-
-
Method Details
-
get
Description copied from interface:CacheGets a value from the cache -
getObject
Description copied from interface:CacheGets a value from the cache -
put
Description copied from interface:CacheStores a value in the cache -
put
Description copied from interface:CacheStores a value in the cache- Specified by:
putin interfaceCache- Parameters:
key- the key under which a value is to be storedvalue- the value that is to be storedtimeToLive- the amount of time in seconds for which the cached value is valid from the time it's being added to the cache. It's provider specific whether the cache implementation will actually remove (evict) the entry after this time has elapsed or will only perform a check upon accessing the cache entry. Whatever method the implementation chooses; after this time is elapsed a call toCache.get(String)should return null.
-
putObject
Description copied from interface:CacheStores a value in the cache- Specified by:
putObjectin interfaceCache- Parameters:
key- the key under which a value is to be storedvalue- the value that is to be storedtimeToLive- the amount of time in seconds for which the cached value is valid from the time it's being added to the cache. It's provider specific whether the cache implementation will actually remove (evict) the entry after this time has elapsed or will only perform a check upon accessing the cache entry. Whatever method the implementation chooses; after this time is elapsed a call toCache.get(String)should return null.
-
putAttribute
Description copied from interface:CacheStores a named attribute in the cache entry identified by the key parameter.- Specified by:
putAttributein interfaceCache- Parameters:
key- key that identifies the first level cache entryname- name of the attribute in the second levelvalue- value associated with the {key, name} hierarchy.timeToLive- the amount of time in seconds for which the cached value is valid. Only used when there's no first level entry yet.
-
getAttribute
Description copied from interface:CacheGets a named attribute from the cache entry identified by the key parameter.This in effect implements a 2-level multi-map, which the single main value stored in the first level, and the optional attributes stored in the second level.
- Specified by:
getAttributein interfaceCache- Parameters:
key- key that identifies the first level cache entryname- name of the attribute in the second level- Returns:
- the value associated with the {key, name} hierarchy.
-
remove
Description copied from interface:CacheRemoves a value from the cache -
clear
public void clear()Description copied from interface:CacheClears the entire cache -
setCacheStore
-