info.magnolia.module.cache.cachepolicy
Class Never

java.lang.Object
  extended by info.magnolia.module.cache.cachepolicy.Never
All Implemented Interfaces:
CachePolicy

public class Never
extends Object
implements CachePolicy

Cache policy instructing cache not to store the generated content.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
Never()
           
 
Method Summary
 void persistCacheKey(String repo, String uuid, Object key)
          Presists mapping between uuid and cache key in case the given cache policy implementation cares about such details.
 Object[] removeCacheKeys(String uuid, String repository)
          Returns cache keys for the given item or null if such keys can't be obtained or policy doesn't want to share it.
 Object retrieveCacheKey(info.magnolia.cms.core.AggregationState aggregationState)
          Returns cache key for the given item or null if such key can't be obtained or policy doesn't want to share it.
 Object[] retrieveCacheKeys(String uuid, String repository)
          Returns cache keys for the given item or null if such keys can't be obtained or policy doesn't want to share it.
 CachePolicyResult shouldCache(Cache cache, info.magnolia.cms.core.AggregationState aggregationState, FlushPolicy flushPolicy)
          Implementations can chose whether to cache or not - but note that the aggregationState might not be completely populated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Never

public Never()
Method Detail

shouldCache

public CachePolicyResult shouldCache(Cache cache,
                                     info.magnolia.cms.core.AggregationState aggregationState,
                                     FlushPolicy flushPolicy)
Description copied from interface: CachePolicy
Implementations can chose whether to cache or not - but note that the aggregationState might not be completely populated. Every request should be cacheable, not only those processed through Magnolia's RenderingFilter.

Specified by:
shouldCache in interface CachePolicy

retrieveCacheKey

public Object retrieveCacheKey(info.magnolia.cms.core.AggregationState aggregationState)
Description copied from interface: CachePolicy
Returns cache key for the given item or null if such key can't be obtained or policy doesn't want to share it. When using aggregationState, key is expected to be composed with aggregated request in mind and policy has to choose only one such key denoting item to return to the client, if such an item indeed exists and can be served. When not existing key might be used to store the cache entry. Since only one version of the content can be streamed back to the client, it makes sense to create only one cache entry for the such a key as well.

Specified by:
retrieveCacheKey in interface CachePolicy

retrieveCacheKeys

public Object[] retrieveCacheKeys(String uuid,
                                  String repository)
Description copied from interface: CachePolicy
Returns cache keys for the given item or null if such keys can't be obtained or policy doesn't want to share it. Since in this case uuid is used to retrieve the cache key, it is quite possible that multiple different representations of the content denoted by uuid exist and all such keys should be returned leaving it up to requesting object to deal with such a multiplicity. Please note that returned keys might not be necessary multiple representations of the content denoted by provided uuid, but also quite possibly all the content deemed related or partially used to construct any of the returned cache keys.

Specified by:
retrieveCacheKeys in interface CachePolicy

persistCacheKey

public void persistCacheKey(String repo,
                            String uuid,
                            Object key)
Description copied from interface: CachePolicy
Presists mapping between uuid and cache key in case the given cache policy implementation cares about such details.

Specified by:
persistCacheKey in interface CachePolicy

removeCacheKeys

public Object[] removeCacheKeys(String uuid,
                                String repository)
Description copied from interface: CachePolicy
Returns cache keys for the given item or null if such keys can't be obtained or policy doesn't want to share it. Since in this case uuid is used to retrieve the cache key, it is quite possible that multiple different representations of the content denoted by uuid exist and all such keys should be returned leaving it up to requesting object to deal with such a multiplicity. Please note that returned keys might not be necessary multiple representations of the content denoted by provided uuid, but also quite possibly all the content deemed related or partially used to construct any of the returned cache keys. At the call to this method, cache policy should not only return the keys associated with the uuid, but also remove all returned uuid-cahce key mappings.

Specified by:
removeCacheKeys in interface CachePolicy


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.