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 TypeMethodDescriptionvoid
addAll
(Collection<? extends T> entries) Adds a number of entries to the cache.protected void
Adds an entry to the cache.protected void
addNullEntry
(Object key) Adds a null entry to the cache.void
clear()
Clears the cache.boolean
Returns if the cache contains a particular cache key.protected String
Creates a Jedis bucket:key key.Retrieves an entry from the cache.getAll
(Collection<?> keys) Returns multiple objects from the cache.long
Returns the total number of cache errors.protected long
getExpiryTime
(T entry) Returns the expiration time for a cache entry, based on the cache or the entry's expiration time.int
This method is repurposed to deliver the round-trip latency to the cache server.boolean
isRemote()
Returns if the cache is a remote cache.void
Invalidate a cache entry.int
size()
Returns the current size of the cache.Methods inherited from class org.deltava.util.cache.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:Cache
Adds 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:Cache
Adds 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:
addNullEntry
in 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:
getMaxSize
in classCache<T extends Cacheable>
- Returns:
- the latency in nanoseconds
-
size
-