|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.xtext.util.OnChangeEvictingCache
public class OnChangeEvictingCache
A cache implementation that stores its values in the scope of a resource.
The values will be discarded as soon as the contents of the resource changes semantically.
Clients may override this behavior for certain transactions by means of execWithoutCacheClear(Resource, IUnitOfWork)
or execWithTemporaryCaching(Resource, IUnitOfWork)
.
Nested Class Summary | |
---|---|
static class |
OnChangeEvictingCache.CacheAdapter
|
static interface |
OnChangeEvictingCache.Listener
A simple cache listener. |
Nested classes/interfaces inherited from interface org.eclipse.xtext.util.IResourceScopeCache |
---|
IResourceScopeCache.NullImpl |
Constructor Summary | |
---|---|
OnChangeEvictingCache()
|
Method Summary | ||
---|---|---|
protected void |
cacheHit(OnChangeEvictingCache.CacheAdapter adapter)
Announce a cache hit for the internal statistics of the adapter. |
|
protected void |
cacheMiss(OnChangeEvictingCache.CacheAdapter adapter)
Announce a cache miss for the internal statistics of the adapter. |
|
void |
clear(org.eclipse.emf.ecore.resource.Resource resource)
Clears the cache of the given resource. |
|
|
execWithoutCacheClear(Param resource,
IUnitOfWork<Result,Param> transaction)
The transaction will be executed. |
|
|
execWithTemporaryCaching(Param resource,
IUnitOfWork<Result,Param> transaction)
The transaction will be executed with caching enabled. |
|
|
get(java.lang.Object key,
org.eclipse.emf.ecore.resource.Resource resource,
com.google.inject.Provider<T> provider)
Try to obtain the value that is cached for the given key in the given resource. |
|
OnChangeEvictingCache.CacheAdapter |
getOrCreate(org.eclipse.emf.ecore.resource.Resource resource)
Returns the cache adapter that is associated with the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OnChangeEvictingCache()
Method Detail |
---|
public void clear(org.eclipse.emf.ecore.resource.Resource resource)
clear
in interface IResourceScopeCache
public <T> T get(java.lang.Object key, org.eclipse.emf.ecore.resource.Resource resource, com.google.inject.Provider<T> provider)
get
in interface IResourceScopeCache
resource
- the resource. If it is null
, the provider will be used to compute the value.key
- the cache key. May not be null
.provider
- the strategy to compute the value if necessary. May not be null
.
protected void cacheMiss(OnChangeEvictingCache.CacheAdapter adapter)
protected void cacheHit(OnChangeEvictingCache.CacheAdapter adapter)
public OnChangeEvictingCache.CacheAdapter getOrCreate(org.eclipse.emf.ecore.resource.Resource resource)
null
.
resource
- the resource. May not be null
.
null
.public <Result,Param extends org.eclipse.emf.ecore.resource.Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result,Param> transaction) throws org.eclipse.emf.common.util.WrappedException
org.eclipse.emf.common.util.WrappedException
public <Result,Param extends org.eclipse.emf.ecore.resource.Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result,Param> transaction) throws org.eclipse.emf.common.util.WrappedException
org.eclipse.emf.common.util.WrappedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |