org.webmacro.resource
Class CachingProvider
java.lang.Object
|
+--org.webmacro.resource.CachingProvider
- All Implemented Interfaces:
- Provider, ResourceLoader
- Direct Known Subclasses:
- BrokerTemplateProvider, TemplateProvider, UrlProvider, URLTemplateProvider
- public abstract class CachingProvider
- extends java.lang.Object
- implements Provider, ResourceLoader
CacheManager is an abstract base class for providers which wish to
implement caching functionality. By extending CachingProvider and
implementing the methods in ResourceLoader, a provider can
automatically support caching using any CacheManager. CachingProvider
looks in the properties file to find the desired cache manager.
- Since:
- 0.96
Method Summary |
void |
destroy()
Close down the provider. |
void |
flush()
Clear the cache. |
java.lang.Object |
get(java.lang.String query)
Get the object associated with the specific query, using the
specified cache manager. |
void |
init(Broker b,
Settings config)
If you override this method be sure and call super.init(...) |
java.lang.Object |
load(java.lang.Object query,
CacheElement ce)
Load an object from permanent storage (or construct it) on
demand. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_cacheSupportsReload
protected boolean _cacheSupportsReload
CachingProvider
public CachingProvider()
init
public void init(Broker b,
Settings config)
throws InitException
- If you override this method be sure and call super.init(...)
- Specified by:
init
in interface Provider
flush
public void flush()
- Clear the cache. If you override this method be sure
and call super.flush().
- Specified by:
flush
in interface Provider
destroy
public void destroy()
- Close down the provider. If you override this method be
sure and call super.destroy().
- Specified by:
destroy
in interface Provider
get
public java.lang.Object get(java.lang.String query)
throws ResourceException
- Get the object associated with the specific query, using the
specified cache manager.
- Specified by:
get
in interface Provider
load
public java.lang.Object load(java.lang.Object query,
CacheElement ce)
throws ResourceException
- Description copied from interface:
ResourceLoader
- Load an object from permanent storage (or construct it) on
demand. Classes which extend CachingProvider don't need to
supply this, since providers will only be called with String
queries.
- Specified by:
load
in interface ResourceLoader
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object