T - Class of object to be stored in cacheU - Class of object idpublic class StravaCacheImpl<T extends StravaCacheable<U>,U> extends Object implements StravaCache<T,U>
| Constructor and Description |
|---|
StravaCacheImpl(Class<T> class1,
Token token) |
| Modifier and Type | Method and Description |
|---|---|
T |
get(U id)
Retrieves the object from the cache.
|
protected Token |
getToken()
Get the token in use
|
List<T> |
list()
Returns a list of the objects in the cache
|
void |
put(T object)
Stores the given object in the cache
|
void |
putAll(List<T> list)
Puts all the contents of the list in the cache
|
void |
remove(U id)
Removes the object identified by the key from the cache
|
void |
removeAll()
Removes all elements from the cache that are associated with the token
|
int |
size()
Returns the number of objects in the cache
|
public T get(U id)
StravaCacheRetrieves the object from the cache.
get in interface StravaCache<T extends StravaCacheable<U>,U>id - The keynull if not in cacheStravaCache.get(java.lang.Object)protected Token getToken()
public List<T> list()
StravaCacheReturns a list of the objects in the cache
list in interface StravaCache<T extends StravaCacheable<U>,U>StravaCache.list()public void put(T object)
StravaCacheStores the given object in the cache
put in interface StravaCache<T extends StravaCacheable<U>,U>object - ObjectStravaCache.put(javastrava.cache.StravaCacheable)public void putAll(List<T> list)
StravaCachePuts all the contents of the list in the cache
putAll in interface StravaCache<T extends StravaCacheable<U>,U>list - List of objects to be stored in cacheStravaCache.putAll(java.util.List)public void remove(U id)
StravaCacheRemoves the object identified by the key from the cache
remove in interface StravaCache<T extends StravaCacheable<U>,U>id - The key of the object to be removedStravaCache.remove(java.lang.Object)public void removeAll()
StravaCacheRemoves all elements from the cache that are associated with the token
removeAll in interface StravaCache<T extends StravaCacheable<U>,U>StravaCache.removeAll()public int size()
StravaCacheReturns the number of objects in the cache
size in interface StravaCache<T extends StravaCacheable<U>,U>StravaCache.size()Copyright © 2016 Dan Shannon. All rights reserved.