Constructor and Description |
---|
RAMCache() |
Modifier and Type | Method and Description |
---|---|
CacheLayer |
createCacheLayer(RawEntity<?> entity)
Retrieves a
CacheLayer instance which corresponds to the given
entity. |
void |
dispose()
Frees all resources associated with the cache.
|
public CacheLayer createCacheLayer(RawEntity<?> entity)
Cache
Retrieves a CacheLayer
instance which corresponds to the given
entity. CacheLayer
instance(s) may themselves be cached within
the value cache, but this is not part of the specification. Generically,
this method should return an instance of a working CacheLayer
implementation which can persist values relevant to the given entity in an
implementation-specific way. For example, the default implementation of this
interface (RAMCache
) returns a CacheLayer
which can
cache values in memory for a specific entity.
Typically, instances of the same implementation are returned for any
given entity (e.g. RAMCacheLayer
always returns an instance of
RAMValueCache
, regardless of the entity in question). It is
theoretically possible however to differentiate layers based on entity type
or even specific primary key value. I'm not sure why you would want to do
this, but there's nothing in the requirements which would prevent it. Code
which uses the result of this method should certainly be written to the
interface, rather than any specific implementation.
createCacheLayer
in interface Cache
entity
- TODOpublic void dispose()
Cache
EntityManager
on the old ValueCache
when a new instance is specified.dispose
in interface Cache
EntityManager.setCache(Cache)
Copyright © 2007-2014. All Rights Reserved.