Class CachedMapFacade<V extends Cacheable>
- java.lang.Object
 - 
- edu.uiuc.ncsa.security.core.cache.CachedMapFacade<V>
 
 
- 
- All Implemented Interfaces:
 Store<V>,Map<Identifier,V>
public abstract class CachedMapFacade<V extends Cacheable> extends Object implements Store<V>
A Facade for a map that is backed by a cache. Since all stores are logically maps as well, this can be used to cache any store.
Note: This persists immediately on put, so there are lazy reads but not writes. Gets to this are checked against the cache. If found, then that is returned, if not, the store is checked. Invoking put will either add a new item to the store or over-write an existing one with the same identifier. There is consequently a save operation implied with it.Usage
Extend this to the correct parameters. Implement any interfaces you need for storage then set the backing store to be your real store and use this class everyplace you would normally have your store.
This will remove from the store immediately as well.Created by Jeff Gaynor
on Nov 12, 2010 at 11:31:47 AM 
- 
- 
Field Summary
- 
Fields inherited from interface edu.uiuc.ncsa.security.core.Store
VERSION_TAG 
 - 
 
- 
Constructor Summary
Constructors Constructor Description CachedMapFacade()CachedMapFacade(Store<V> theStore) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<Identifier,V>>entrySet()Vget(Object key)CachegetCache()Store<V>getTheStore()booleanhasStore()booleanisEmpty()Set<Identifier>keySet()Vput(Identifier key, V cacheable)voidputAll(Map<? extends Identifier,? extends V> m)Vremove(Object key)voidsetCache(Cache cache)voidsetTheStore(Store<V> theStore)intsize()Collection<V>values()- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getCache
public Cache getCache()
 
- 
setCache
public void setCache(Cache cache)
 
- 
hasStore
public boolean hasStore()
 
- 
clear
public void clear()
- Specified by:
 clearin interfaceMap<Identifier,V extends Cacheable>
 
- 
isEmpty
public boolean isEmpty()
- Specified by:
 isEmptyin interfaceMap<Identifier,V extends Cacheable>
 
- 
containsKey
public boolean containsKey(Object key)
- Specified by:
 containsKeyin interfaceMap<Identifier,V extends Cacheable>
 
- 
containsValue
public boolean containsValue(Object value)
- Specified by:
 containsValuein interfaceMap<Identifier,V extends Cacheable>
 
- 
put
public V put(Identifier key, V cacheable)
- Specified by:
 putin interfaceMap<Identifier,V extends Cacheable>
 
- 
remove
public V remove(Object key)
- Specified by:
 removein interfaceMap<Identifier,V extends Cacheable>
 
- 
putAll
public void putAll(Map<? extends Identifier,? extends V> m)
- Specified by:
 putAllin interfaceMap<Identifier,V extends Cacheable>
 
- 
entrySet
public Set<Map.Entry<Identifier,V>> entrySet()
- Specified by:
 entrySetin interfaceMap<Identifier,V extends Cacheable>
 
- 
size
public int size()
- Specified by:
 sizein interfaceMap<Identifier,V extends Cacheable>
 
- 
keySet
public Set<Identifier> keySet()
- Specified by:
 keySetin interfaceMap<Identifier,V extends Cacheable>
 
- 
values
public Collection<V> values()
- Specified by:
 valuesin interfaceMap<Identifier,V extends Cacheable>
 
 - 
 
 -