ERXWOResponseCache Class Reference

Collaboration diagram for ERXWOResponseCache:

Collaboration graph
[legend]

List of all members.

Classes

interface  Cacheable
interface  Policy

Public Member Functions

boolean actionNameIsCachableForClass (Class actionClass, String actionName)
WOResponse cachedResponseForRequest (Class actionClass, String actionName, WORequest request)
void cacheResponseForRequest (Class actionClass, String actionName, WORequest request, WOResponse response)
 ERXWOResponseCache ()
void flushCache ()
boolean hasPolicy ()
boolean isEnabled ()
Policy policy ()
void setIsEnabled (boolean enabled)
void setPolicy (Policy policy)

Static Public Member Functions

static ERXWOResponseCache sharedInstance ()

Static Public Attributes

static String NO_CACHE_KEY = "ERXDirectActionRequestHandler.DontCache"

Protected Attributes

Map cache
Boolean isEnabled
Policy policy

Static Protected Attributes

static ERXWOResponseCache sharedInstance


Detailed Description

The response cache is a way to cache WOResponse output from a DirectAction for a given set of cache keys. You can specify the headers, formValues and cookies to take into account. Your DirectAction class must implement the Cacheable interface and should look like this:

 public class DirectAction extends WODirectAction implements ERXWOResponseCache.Cacheable {
    static {
        ERXWOResponseCacheKeyPolicy.sharedInstance().createPolicyEntryForClass(DirectAction.class, 
            new NSArray(new Object[] {"default", "cached"}), 
            NSArray.EmptyArray, NSArray.EmptyArray, NSArray.EmptyArray);
    }
    public DirectAction(WORequest aRequest) {
        super(aRequest);
    }

    public WOActionResults notCachedAction() {
        return pageWithName("NotCached");
    }

    public WOActionResults cachedAction() {
        return pageWithName("Cached");
    }

    public WOActionResults defaultAction() {
        return pageWithName("Main");
    }
}
You must also set the default er.extensions.ERXWOResponseCache.Enabled=true for the cache to get used.

Constructor & Destructor Documentation


Member Function Documentation

boolean actionNameIsCachableForClass ( Class  actionClass,
String  actionName 
)

WOResponse cachedResponseForRequest ( Class  actionClass,
String  actionName,
WORequest  request 
)

void cacheResponseForRequest ( Class  actionClass,
String  actionName,
WORequest  request,
WOResponse  response 
)

void flushCache (  ) 

boolean hasPolicy (  ) 

boolean isEnabled (  ) 

Policy policy (  ) 

void setIsEnabled ( boolean  enabled  ) 

void setPolicy ( Policy  policy  ) 

static ERXWOResponseCache sharedInstance (  )  [static]

Gets the shared instance

Returns:
the shared instance


Member Data Documentation

Map cache [protected]

Boolean isEnabled [protected]

String NO_CACHE_KEY = "ERXDirectActionRequestHandler.DontCache" [static]

Header key you can set in the response when creating an error page you don't want to get cached.

Policy policy [protected]

ERXWOResponseCache sharedInstance [static, protected]

Holds a reference to the shared instance


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:02 2012 for Project Wonder by  doxygen 1.5.8