m.c.m.proxyma.plugins.caches
Class EhcacheCacheProvider

java.lang.Object
  extended by m.c.m.proxyma.plugins.caches.EhcacheCacheProvider
All Implemented Interfaces:
CacheProvider

public class EhcacheCacheProvider
extends java.lang.Object
implements CacheProvider

This is a wrapper for the famous ecache cache subsystem.
It implements the CacheProvider interface to make Proxyma able to work with it.
IMPORTANT: The cache manager is not shared between different proxyma contexts.

Finally, the cache provider is used twice into the proxyma engine:

NOTE: this software is released under GPL License. See the LICENSE of this distribution for more informations.

Version:
$Id: EhcacheCacheProvider.java 170 2010-07-02 21:16:10Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Field Summary
static java.lang.String CACHE_CONTROL_MAX_AGE
          Cache control value that means: this can be cached for X seconds
static java.lang.String CACHE_CONTROL_NO_CACHE
          No cache value for the Pragma header
static java.lang.String CACHE_CONTROL_NO_STORE
          Cache control value that means: no, don't cache this
static java.lang.String CACHE_CONTROL_PRIVATE
          Cache control value that means: You can cache it only for this user.
static java.lang.String CACHE_CONTROL_PUBLIC
          Cache control value that means: ok, cache it!
static java.lang.String CACHE_CONTROL_S_MAXAGE
          Similar to the previous but for shared caches
static java.lang.String PRAGMA_NO_CACHE
          No cache value for the Pragma header
 
Constructor Summary
EhcacheCacheProvider(ProxymaContext context)
          The default constructor for all the plugins.
 
Method Summary
 java.util.Collection<java.lang.String> getCachedURIs()
          This method does nothing.
 java.lang.String getHtmlDescription()
          Returns a short description of the cache provider formatted for html output.
 java.lang.String getName()
          Returns the name of the cache provider (only a name that characterize the plugin, not the class name..) that could be used into the interfaces as cache name.
 boolean getResponseData(ProxymaResource aResource)
          This method searches into the cache subsystem using the URI and the QueryString of the request countained into the passed resource.
 java.lang.String getStatistics()
          This method does nothing.
 void storeResponseDataIfCacheable(ProxymaResource aResource)
          This method stores the data of a response into the cache subsystem using as key the request URI and the QueryString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRAGMA_NO_CACHE

public static final java.lang.String PRAGMA_NO_CACHE
No cache value for the Pragma header

See Also:
Constant Field Values

CACHE_CONTROL_PUBLIC

public static final java.lang.String CACHE_CONTROL_PUBLIC
Cache control value that means: ok, cache it!

See Also:
Constant Field Values

CACHE_CONTROL_PRIVATE

public static final java.lang.String CACHE_CONTROL_PRIVATE
Cache control value that means: You can cache it only for this user.

See Also:
Constant Field Values

CACHE_CONTROL_NO_CACHE

public static final java.lang.String CACHE_CONTROL_NO_CACHE
No cache value for the Pragma header

See Also:
Constant Field Values

CACHE_CONTROL_NO_STORE

public static final java.lang.String CACHE_CONTROL_NO_STORE
Cache control value that means: no, don't cache this

See Also:
Constant Field Values

CACHE_CONTROL_MAX_AGE

public static final java.lang.String CACHE_CONTROL_MAX_AGE
Cache control value that means: this can be cached for X seconds

See Also:
Constant Field Values

CACHE_CONTROL_S_MAXAGE

public static final java.lang.String CACHE_CONTROL_S_MAXAGE
Similar to the previous but for shared caches

See Also:
Constant Field Values
Constructor Detail

EhcacheCacheProvider

public EhcacheCacheProvider(ProxymaContext context)
The default constructor for all the plugins.

Parameters:
context - the context where the plugin is instantiated
Method Detail

storeResponseDataIfCacheable

public void storeResponseDataIfCacheable(ProxymaResource aResource)
This method stores the data of a response into the cache subsystem using as key the request URI and the QueryString.

Specified by:
storeResponseDataIfCacheable in interface CacheProvider
Parameters:
aResource - the resource that countains the data to store.

getResponseData

public boolean getResponseData(ProxymaResource aResource)
This method searches into the cache subsystem using the URI and the QueryString of the request countained into the passed resource.

Specified by:
getResponseData in interface CacheProvider
Parameters:
aResource - the resource that countains the data to perform the search.
Returns:
true if the cache countains a resource that matches the requisites.

getCachedURIs

public java.util.Collection<java.lang.String> getCachedURIs()
This method does nothing.

Specified by:
getCachedURIs in interface CacheProvider
Returns:
always an empty Collection.

getStatistics

public java.lang.String getStatistics()
This method does nothing.

Specified by:
getStatistics in interface CacheProvider
Returns:
always the same message

getName

public java.lang.String getName()
Description copied from interface: CacheProvider
Returns the name of the cache provider (only a name that characterize the plugin, not the class name..) that could be used into the interfaces as cache name.

Specified by:
getName in interface CacheProvider
Returns:
the cache name.

getHtmlDescription

public java.lang.String getHtmlDescription()
Returns a short description of the cache provider formatted for html output.

Specified by:
getHtmlDescription in interface CacheProvider
Returns:
the description of the cache provider


Copyright © 2010. All Rights Reserved.