Class JedisGeoCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.JedisCache<T>
org.deltava.util.cache.JedisGeoCache<T>
- Type Parameters:
T
- the Cacheable object type
- All Implemented Interfaces:
GeoCache<T>
A cache to store geographic lookups in Redis. Lat/long coordinates are automatically reduced to a set number of decimal places.
- Since:
- 7.3
- Version:
- 11.3
- Author:
- Luke
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionJedisGeoCache
(String bucket, int expiry, double roundAmt) Creates the cache. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(GeoLocation loc, T data) Adds a geographically located object to the cache.void
addNull
(GeoLocation loc) Adds a null entry to the cache.boolean
contains
(GeoLocation loc) Returns whether the cache contains an entry for a particular location.get
(GeoLocation loc) Retrieves an object from the cache.double
Returns the precision of the lat/long key rounding.void
remove
(GeoLocation loc) Removes a location entry from the cache.Methods inherited from class org.deltava.util.cache.JedisCache
addAll, addEntry, addNullEntry, clear, contains, createKey, get, getAll, getErrors, getExpiryTime, getMaxSize, isRemote, remove, size
Methods inherited from class org.deltava.util.cache.Cache
add, addNull, checkOverflow, getHits, getRequests, hit, request, setMaxSize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.deltava.util.cache.GeoCache
createGeoKey
-
Constructor Details
-
JedisGeoCache
Creates the cache.- Parameters:
bucket
- the Redis bucket nameexpiry
- the expirty time in secondsroundAmt
- the rounding factot to apply to latitude/longitude
-
-
Method Details
-
getRoundingAmount
public double getRoundingAmount()Description copied from interface:GeoCache
Returns the precision of the lat/long key rounding.- Specified by:
getRoundingAmount
in interfaceGeoCache<T extends Cacheable>
- Returns:
- the rounding amount
-
add
-
addNull
Adds a null entry to the cache. -
contains
Returns whether the cache contains an entry for a particular location. -
get
-
remove
Removes a location entry from the cache.
-