Class NullCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.NullCache<T>
- Type Parameters:
T- the Cacheable object type
- All Implemented Interfaces:
GeoCache<T>
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(GeoLocation loc, T data) Adds a geographically located object to the cache.protected voidAdds an entry to the cache.voidaddNull(GeoLocation loc) Adds a null entry to the cache.protected voidaddNullEntry(Object key) Adds a null entry to the cache.booleancontains(GeoLocation loc) Returns whether the cache contains an entry for a particular location.Retrieves an entry from the cache.get(GeoLocation loc) Retrieves an object from the cache.getAll(Collection<?> keys) Returns multiple objects from the cache.final intReturns the maximum size of the cache.doubleReturns the precision of the lat/long key rounding.voidremove(GeoLocation loc) Removes a location entry from the cache.Methods inherited from class Cache
add, addAll, addNull, checkOverflow, clear, contains, getErrors, getHits, getRequests, hit, isRemote, remove, request, setMaxSize, sizeModifier and TypeMethodDescriptionfinal voidAdds an entry to the cache.voidaddAll(Collection<? extends T> entries) Adds a number of entries to the cache.final voidAdds a null entry to the cache.protected voidAutomatically resizes the cache in the case of an overflow.voidclear()Clears the cache.booleanReturns if the cache contains a particular cache key.longReturns the total number of cache errors.final longgetHits()Returns the total number of cache hits.final longReturns the total number of cache requests.protected voidhit()Log a cache hit.booleanisRemote()Returns if the cache is a remote cache.voidInvalidate a cache entry.protected voidrequest()Log a cache request.final voidsetMaxSize(int size) Sets the maximum size of the cache.intsize()Returns the current size of the cache.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GeoCache
createGeoKeyModifier and TypeMethodDescriptiondefault StringcreateGeoKey(GeoLocation loc) Creates a lat/long key by rounding to the specific number of decimal places.
-
Constructor Details
-
NullCache
NullCache()Creates a new null cache.
-
-
Method Details
-
getMaxSize
public final int getMaxSize()Returns the maximum size of the cache.- Overrides:
getMaxSizein classCache<T extends Cacheable>- Returns:
- the maximum number of entries in the cache
-
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. -
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
-
get
-
getRoundingAmount
public double getRoundingAmount()Description copied from interface:GeoCacheReturns the precision of the lat/long key rounding.- Specified by:
getRoundingAmountin interfaceGeoCache<T extends Cacheable>- Returns:
- the rounding amount
-
add
-
addNull
-
contains
Description copied from interface:GeoCacheReturns whether the cache contains an entry for a particular location. -
get
-
getAll
-
remove
-