Class JedisCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.JedisCache<T>
- Type Parameters:
T- the Cacheable object type
- Direct Known Subclasses:
JedisGeoCache
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAll(Collection<? extends T> entries) Adds a number of entries to the cache.protected voidAdds an entry to the cache.protected voidaddNullEntry(Object key) Adds a null entry to the cache.voidclear()Clears the cache.booleanReturns if the cache contains a particular cache key.protected StringCreates a Jedis bucket:key key.Retrieves an entry from the cache.getAll(Collection<?> keys) Returns multiple objects from the cache.longReturns the total number of cache errors.protected longgetExpiryTime(T entry) Returns the expiration time for a cache entry, based on the cache or the entry's expiration time.intThis method is repurposed to deliver the round-trip latency to the cache server.booleanisRemote()Returns if the cache is a remote cache.voidInvalidate a cache entry.intsize()Returns the current size of the cache.Methods inherited from class Cache
add, addNull, checkOverflow, getHits, getRequests, hit, request, setMaxSize
-
Constructor Details
-
JedisCache
Creates a new Cache.- Parameters:
bucket- the cache key bucket to useexpiry- the expiration time in seconds
-
-
Method Details
-
createKey
-
getExpiryTime
Returns the expiration time for a cache entry, based on the cache or the entry's expiration time.- Parameters:
entry- the entry- Returns:
- the time it will expire
-
getErrors
-
isRemote
-
addEntry
Description copied from class:CacheAdds an entry to the cache. Subclasses need to implement this method to handle cache additions, the public method forces an overflow check. -
addAll
-
addNullEntry
Description copied from class:CacheAdds a null entry to the cache. Subclasses need to implement this method to handle cache additions, the public method forces an overflow check.- Specified by:
addNullEntryin classCache<T extends Cacheable>- Parameters:
key- the entry key
-
contains
-
get
-
remove
-
clear
-
getAll
-
getMaxSize
public int getMaxSize()This method is repurposed to deliver the round-trip latency to the cache server.- Overrides:
getMaxSizein classCache<T extends Cacheable>- Returns:
- the latency in nanoseconds
-
size
-