Package sonia.scm.cache
Interface Cache<K,V>
- Type Parameters:
K
- type of the keys for the cacheV
- type of cached elements
- All Superinterfaces:
org.apache.shiro.cache.Cache<K,
V>
public interface Cache<K,V>
extends org.apache.shiro.cache.Cache<K,V>
The main interface for the cache.
Provides methods to add, access, and remove entries from a cache.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all elements from this cache.boolean
Returns true if this cache contains an element with the specified key.Returns the element with the specified key.Returns performance statistics of the cache or null if the cache does not support statistics.Put a new element to this cache.Remove the element with the specified key from this cache.Remove all elements with matchingPredicate
from this cache.int
size()
Returns the number of entries in the cache.Methods inherited from interface org.apache.shiro.cache.Cache
keys, values
-
Method Details
-
clear
void clear()Remove all elements from this cache. -
contains
Returns true if this cache contains an element with the specified key.- Parameters:
key
- key of the cached element
-
put
Put a new element to this cache. -
remove
Remove the element with the specified key from this cache. Return previous cached value. -
removeAll
Remove all elements with matchingPredicate
from this cache. The method returns all previous cached values.- Parameters:
predicate
- predicate to match cache keys- Since:
- 1.9
-
size
int size()Returns the number of entries in the cache. -
get
Returns the element with the specified key. Returns null if the cache contains no element with the specified key. -
getStatistics
CacheStatistics getStatistics()Returns performance statistics of the cache or null if the cache does not support statistics. The returned statistic is a snapshot of the current performance.- Since:
- 2.0.0
-