Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
This file is part of JPARepositoryCache. Copyright 2015 Ivan Krizsan. JPARepositoryCache is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. JPARepositoryCache is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with JPARepositoryCache. If not, see <http://www.gnu.org/licenses/>.
 
 package se.ivankrizsan.spring.jparepositorycache.repositoryhelpers;
 
 import java.util.List;

Specifies the properties of a cache delegate that is responsible for the caching of the data of one repository. The cache delegate requires two caches to be configured; one for one entity per cache key and one for multiple entities per cache key.

Author(s):
Ivan Krizsan
 
 public interface RepositoryCacheDelegate<T extends EntityWithId<?>> {
     /* Constant(s): */

    
Attempts to retrieve an object from the multiple entities cache using the supplied cache key .

Parameters:
inCacheKey Cache key to use when attempting retrieval.
Returns:
Cached object, or null if no corresponding entry found in cache.
 
     Object findObjectInMultipleEntitiesCache(final String inCacheKey);

    
Attempts to retrieve an entity with supplied cache key from the single entities cache.

Parameters:
inEntityCacheKey Cache key of entity to retrieve.
Returns:
Entity, or null if no such entity found in cache.
 
     T findEntityInSingleEntitiesCache(final String inEntityCacheKey);

    
Evicts all entities from the single entities cache.
 
Evicts all entities from the multiple entities cache.
 
Evicts the entity having the supplied cache key from the single entities cache.

Parameters:
inEntityCacheKey Cache key of entity to evict.
 
     void evictEntityFromSingleEntitiesCache(final String inEntityCacheKey);

    
Inserts the supplied object into the multiple entities cache using the supplied cache key.

Parameters:
inCacheKey Cache key.
inObject Object to insert into cache.
 
     void insertObjectIntoMultipleEntitiesCache(final String inCacheKeyfinal Object inObject);

    
Inserts the supplied entity into the single entities cache.

Parameters:
inEntityCacheKey Key to use when inserting entity into cache.
inEntity Entity to insert into cache.
 
     void insertEntityIntoSingleEntitiesCache(final String inEntityCacheKeyfinal T inEntity);

    
Retrieves the cache(s) maintained by the delegate when caching data for a repository.

Returns:
List of caches.
 
     List<CacheWrappergetDelegateCaches();

    
Sets the name of the single entity cache for a repository. This name needs to be unique among all caches used to cache repository data. Setting the name to null or not setting the name will cause a generated cache name to be used.

Parameters:
inSingleEntitiesCacheName Name of single entity cache for a repository.
 
     void setSingleEntitiesCacheName(final String inSingleEntitiesCacheName);
 
     String getSingleEntitiesCacheName();

    
Sets the name of the multiple entities cache for a repository. This name needs to be unique among all caches used to cache repository data. Setting the name to null or not setting the name will cause a generated cache name to be used.

Parameters:
inMultipleEntitiesListCacheName Name of multiple entities cache for a repository.
    void setMultipleEntitiesListCacheName(final String inMultipleEntitiesListCacheName);
    void setCacheManager(final CacheManager inCacheManager);
New to GrepCode? Check out our FAQ X