Class ExpiringGeoCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.ExpiringCache<T>
org.deltava.util.cache.ExpiringGeoCache<T>
- Type Parameters:
T
- the Cacheable object type
- All Implemented Interfaces:
GeoCache<T>
A cache to store geographic lookups. Lat/long coordinates are automatically reduced to a set number of decimal places.
- Since:
- 7.3
- Version:
- 7.4
- Author:
- Luke
-
Nested Class Summary
Nested classes/interfaces inherited from class org.deltava.util.cache.ExpiringCache
ExpiringCache.ExpiringLocalCacheEntry<U extends T>, ExpiringCache.ExpiringNullCacheEntry<U extends T>
-
Field Summary
Fields inherited from class org.deltava.util.cache.ExpiringCache
_expiry, _lastCreationTime
-
Constructor Summary
ConstructorsConstructorDescriptionExpiringGeoCache
(int maxSize, int expiryTime, double roundAmt) Creates a new 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.ExpiringCache
addEntry, addNullEntry, checkOverflow, contains, get, get, isExpired, setExpiration
Methods inherited from class org.deltava.util.cache.Cache
add, addAll, addNull, clear, getAll, getErrors, getHits, getMaxSize, getRequests, hit, isRemote, remove, request, setMaxSize, size
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
-
ExpiringGeoCache
public ExpiringGeoCache(int maxSize, int expiryTime, double roundAmt) Creates a new Cache.- Parameters:
maxSize
- the maximum number of entriesexpiryTime
- the expiration time in secondsroundAmt
- the number of decimal places to round to- See Also:
-
-
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.
-