org.webmacro.resource
Interface CacheManager

All Known Implementing Classes:
TrivialCacheManager, StaticSMapCacheManager, StaticIdentityCacheManager, HMapCacheManager, SMapCacheManager, GenerationalCacheManager

public interface CacheManager

The CacheManager sits between the template provider and WM. This interface specifies all the functions of the cache manager, allowing a complete separation of the fetching of resources from how they are cached. CachingProvider looks in the properties file to figure out what cache manager to load.

Since:
0.96
Author:
Brian Goetz

Method Summary
 void destroy()
          Same as defined in Provider
 void flush()
          Same as defined in Provider
 java.lang.Object get(java.lang.Object query)
          Called to get a resource from the cache.
 java.lang.Object get(java.lang.Object query, ResourceLoader helper)
          Called to get a resource from the cache.
 void init(Broker b, Settings config, java.lang.String resourceType)
          Same as defined in Provider, except with an additional type parameter so it knows what type of resource it is caching
 void invalidate(java.lang.Object query)
          Invalidates an entry in the cache.
 void put(java.lang.Object query, java.lang.Object resource)
          Called to put a resource into the cache.
 boolean supportsReload()
          Does this cache manager support reloading of resources if the underlying resource has changed?
 

Method Detail

init

public void init(Broker b,
                 Settings config,
                 java.lang.String resourceType)
          throws InitException
Same as defined in Provider, except with an additional type parameter so it knows what type of resource it is caching

flush

public void flush()
Same as defined in Provider

destroy

public void destroy()
Same as defined in Provider

get

public java.lang.Object get(java.lang.Object query,
                            ResourceLoader helper)
                     throws ResourceException
Called to get a resource from the cache. The helper object is used to load the resource if the resource was not in the cache.

get

public java.lang.Object get(java.lang.Object query)
Called to get a resource from the cache. Returns null if not present.

put

public void put(java.lang.Object query,
                java.lang.Object resource)
Called to put a resource into the cache.

invalidate

public void invalidate(java.lang.Object query)
Invalidates an entry in the cache. Depending on the the implementation, the actual removal from the cache may or may not be immediate.

supportsReload

public boolean supportsReload()
Does this cache manager support reloading of resources if the underlying resource has changed?