Class OnChangeEvictingCache

    • Constructor Detail

      • OnChangeEvictingCache

        public OnChangeEvictingCache()
    • Method Detail

      • clear

        public void clear​(org.eclipse.emf.ecore.resource.Resource resource)
        Clears the cache of the given resource.
        Specified by:
        clear in interface IResourceScopeCache
      • get

        public <T> T 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. If no value is cached, the provider is used to compute it and store it afterwards.
        Specified by:
        get in interface IResourceScopeCache
        Parameters:
        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.
        Returns:
        the cached value or what the provider returns if no cached value exists
      • getOrCreate

        public OnChangeEvictingCache.CacheAdapter getOrCreate​(org.eclipse.emf.ecore.resource.Resource resource)
        Returns the cache adapter that is associated with the resource. The life cycle of the cache is strongly connected to the resource and its change notifications. Will not return null.
        Parameters:
        resource - the resource. May not be null.
        Returns:
        the cache adapter for the given resource. Never null.
      • execWithoutCacheClear

        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
        The transaction will be executed. While it is running, any semantic state change in the given resource will be ignored and the cache will not be cleared.
        Throws:
        org.eclipse.emf.common.util.WrappedException
      • execWithTemporaryCaching

        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
        The transaction will be executed with caching enabled. However, all newly cached values will be discarded as soon as the transaction is over.
        Throws:
        org.eclipse.emf.common.util.WrappedException
        Since:
        2.1