- All Known Implementing Classes:
MockCache
public interface Cache
This class manages object caching. An object is cached mainly for read performance and database offloading. The cache
can also be used to store transient data which is shared among all nodes of the system.
- Author:
- Alex Bogdanovski [[email protected]]
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Do we have this object in the cache?boolean
Do we have this object in the cache?<T> T
Read an object from cache.<T> T
Read an object from cache.Read a number of objects given a list of their ids.Read a number of objects given a list of their ids.<T> void
Store an object in the cache.<T> void
Store an object in the cache.<T> void
Store an object in the cache.<T> void
Store all objects in cache, except those which are null.<T> void
Store all objects in cache, except those which are null.void
Remove an object from cache.void
Remove an object from cache.void
Clears the cache.void
Clears the cache.void
Remove a number of objects from cache given a list of their ids.void
Remove a number of objects from cache given a list of their ids.
-
Method Details
-
contains
Do we have this object in the cache?- Parameters:
id
- the object's id- Returns:
- true if in cache
-
contains
-
put
Store an object in the cache.- Type Parameters:
T
- the type of object to be cached- Parameters:
id
- the object's id, not null or emptyobject
- the object itself, not null
-
put
-
put
Store an object in the cache.- Type Parameters:
T
- the type of object to be cached- Parameters:
appid
- the name of the applicationid
- the object's id, not null or emptyobject
- the object itself, not nullttlSeconds
- the time to live for an object before it is evicted from the cache.- See Also:
-
putAll
-
putAll
-
get
Read an object from cache.- Type Parameters:
T
- the type of object to be cached- Parameters:
id
- the object's id, not null or empty- Returns:
- the object from cache or null if not found
-
get
-
getAll
-
getAll
Read a number of objects given a list of their ids.- Type Parameters:
T
- the type of object to be cached- Parameters:
appid
- the name of the applicationids
- the ids, not null or empty- Returns:
- a map of the objects that are contained in cache (may be empty)
- See Also:
-
remove
Remove an object from cache.- Parameters:
id
- the object's id, not null or empty
-
remove
-
removeAll
void removeAll()Clears the cache. -
removeAll
Clears the cache.- Parameters:
appid
- the name of the application- See Also:
-
removeAll
-
removeAll
-