com.atlassian.greenhopper.service
Class GenericCache<K extends java.io.Serializable,V>
java.lang.Object
com.atlassian.greenhopper.service.GenericCache<K,V>
- Type Parameters:
K
- the key, ideally a unique entity ID. Must be serializableV
- the value, normally the entity. Serializability is not enforced - if ever we want disk overflow, then that'll be required.
- All Implemented Interfaces:
- org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- BacklogCache, XProjectCache
public abstract class GenericCache<K extends java.io.Serializable,V>
- extends java.lang.Object
- implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Generic implementation of an entity cache. An Ehcache
instance is used internally for storage. For configuration, see ehcache.xml
- Author:
- ahennecke
Field Summary |
protected net.sf.ehcache.Ehcache |
cache
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cache
protected net.sf.ehcache.Ehcache cache
GenericCache
public GenericCache()
get
public V get(K key)
- Returns:
- the entity that matches the key, or null if none is in the cache
put
public void put(K key,
V value)
remove
public void remove(K key)
clear
public void clear()
- remove all entries from the cache
afterPropertiesSet
public void afterPropertiesSet()
throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
destroy
public void destroy()
throws java.lang.Exception
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
- Throws:
java.lang.Exception
getCacheName
protected abstract java.lang.String getCacheName()
Copyright © 2007-2011 Atlassian. All Rights Reserved.