- java.lang.Object
-
- io.ebean.cache.TenantAwareCache
-
- All Implemented Interfaces:
ServerCache
public final class TenantAwareCache extends Object implements ServerCache
A ServerCache proxy that is tenant aware.
-
-
Constructor Summary
Constructors Constructor Description TenantAwareCache(ServerCache delegate, TenantAwareKey tenantAwareKey)Create given the TenantAwareKey and delegate cache to proxy to.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries from the cache.Objectget(Object id)Return the value given the key.Map<Object,Object>getAll(Set<Object> keys)Get values for many keys.inthitRatio()Return the hit ratio the cache is currently getting.voidput(Object id, Object value)Put the value in the cache with a given id.voidputAll(Map<Object,Object> keyValues)Put all the values in the cache.voidremove(Object id)Remove a entry from the cache given its id.voidremoveAll(Set<Object> keys)Remove the entries from the cache given the id values.intsize()Return the number of entries in the cache.ServerCacheStatisticsstatistics(boolean reset)Return statistics for the cache.<T> Tunwrap(Class<T> cls)Return the underlying ServerCache that is being delegated to.voidvisit(MetricVisitor visitor)Visit the metrics for the cache.
-
-
-
Constructor Detail
-
TenantAwareCache
public TenantAwareCache(ServerCache delegate, TenantAwareKey tenantAwareKey)
Create given the TenantAwareKey and delegate cache to proxy to.- Parameters:
delegate- The cache to proxy totenantAwareKey- Provides tenant aware keys to use in the cache
-
-
Method Detail
-
unwrap
public <T> T unwrap(Class<T> cls)
Return the underlying ServerCache that is being delegated to.- Specified by:
unwrapin interfaceServerCache
-
visit
public void visit(MetricVisitor visitor)
Description copied from interface:ServerCacheVisit the metrics for the cache.- Specified by:
visitin interfaceServerCache
-
get
public Object get(Object id)
Description copied from interface:ServerCacheReturn the value given the key.- Specified by:
getin interfaceServerCache
-
put
public void put(Object id, Object value)
Description copied from interface:ServerCachePut the value in the cache with a given id.- Specified by:
putin interfaceServerCache
-
remove
public void remove(Object id)
Description copied from interface:ServerCacheRemove a entry from the cache given its id.- Specified by:
removein interfaceServerCache
-
clear
public void clear()
Description copied from interface:ServerCacheClear all entries from the cache.- Specified by:
clearin interfaceServerCache
-
size
public int size()
Description copied from interface:ServerCacheReturn the number of entries in the cache.- Specified by:
sizein interfaceServerCache
-
hitRatio
public int hitRatio()
Description copied from interface:ServerCacheReturn the hit ratio the cache is currently getting.- Specified by:
hitRatioin interfaceServerCache
-
statistics
public ServerCacheStatistics statistics(boolean reset)
Description copied from interface:ServerCacheReturn statistics for the cache.- Specified by:
statisticsin interfaceServerCache- Parameters:
reset- if true the statistics are reset.
-
getAll
public Map<Object,Object> getAll(Set<Object> keys)
Description copied from interface:ServerCacheGet values for many keys.- Specified by:
getAllin interfaceServerCache
-
putAll
public void putAll(Map<Object,Object> keyValues)
Description copied from interface:ServerCachePut all the values in the cache.- Specified by:
putAllin interfaceServerCache
-
removeAll
public void removeAll(Set<Object> keys)
Description copied from interface:ServerCacheRemove the entries from the cache given the id values.- Specified by:
removeAllin interfaceServerCache
-
-