Interface GeoCache<T extends Cacheable>
- Type Parameters:
T- the Cacheable object type
- All Known Implementing Classes:
ExpiringGeoCache,JedisGeoCache,NullCache
public interface GeoCache<T extends Cacheable>
An interface for caches that cache data based on geographic locations.
- Since:
- 7.3
- Version:
- 8.1
- Author:
- Luke
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(GeoLocation loc, T data) Adds a geographically located object to the cache.voidaddNull(GeoLocation loc) Adds a null entry to the cache.booleancontains(GeoLocation loc) Returns whether the cache contains an entry for a particular location.default StringcreateGeoKey(GeoLocation loc) Creates a lat/long key by rounding to the specific number of decimal places.get(GeoLocation loc) Retrieves an object from the cache.doubleReturns the precision of the lat/long key rounding.voidremove(GeoLocation loc) Removes a location entry from the cache.
-
Method Details
-
getRoundingAmount
double getRoundingAmount()Returns the precision of the lat/long key rounding.- Returns:
- the rounding amount
-
add
Adds a geographically located object to the cache.- Parameters:
loc- the GeoLocationdata- the data to cache
-
addNull
-
contains
Returns whether the cache contains an entry for a particular location.- Parameters:
loc- the GeoLocation- Returns:
- TRUE if the cache contains an entry, otherwise FALSE
-
get
Retrieves an object from the cache.- Parameters:
loc- the GeoLocation- Returns:
- the Object, or null if not found
-
remove
Removes a location entry from the cache.- Parameters:
loc- the GeoLocation
-
createGeoKey
Creates a lat/long key by rounding to the specific number of decimal places.- Parameters:
loc- the GeoLocation- Returns:
- a key
-