org.clazzes.util.lifecycle
Interface Cache<T>
- Type Parameters:
T
- The Class used as an id for the cacheable objects. Has to be identical to the Class used by the corresponding
Cacheable
implementations.
- All Superinterfaces:
- ObjectFactory<T>
- All Known Implementing Classes:
- AbstractCacheImpl
public interface Cache<T>
- extends ObjectFactory<T>
Interface providing a common denominator for Cache
implementations. Concrete instances should however
extend AbstractCacheImpl
instead of implementing this interface directly.
A Cache
assures that references to exactly one instance for a given id is returned, no matter how often the
ObjectFactory.get(Object)
method is called.
- Author:
- jpayr
addShareable
void addShareable(Cacheable<T> object)
- Adds a
Cacheable
object to the Cache
. References to this object can be retrieved with
ObjectFactory.get(Object)
. If an object with the same id is already present in the cache, the given instance will be
merged with the resident using the object's Cacheable.merge(Cacheable)
method.
- Parameters:
object
- the object to be added to the cache.
Copyright © 2010. All Rights Reserved.