|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.opencms.flex.cache.CmsFlexCacheKey
Implements the CmsFlexCacheKey, which is a key used to describe the caching behaviour of a specific resource.
It has a lot of "public" variables (which isn't good style, I know) to avoid method calling overhead (a cache is about speed, isn't it :).
| Field Summary | |
int |
m_always
Cache key variable: Determines if this resource can be cached alwys, never or under certain conditions. -1 = never, 0=check, 1=always |
Set |
m_groups
Cache key variable: List of groups |
Set |
m_noparams
Cache key variable: List of "blocking" parameters |
Map |
m_params
Cache key variable: List of parameters |
Set |
m_ports
Cache key variable: The request TCP/IP port |
boolean |
m_publish
Cache key variable: Determines if the resource sould be always cleared at publish time |
Set |
m_schemes
Cache key variable: Distinguishes request schemes (http, https etc.) |
long |
m_timeout
Cache key variable: Timeout of the resource |
String |
m_uri
Cache key variable: The uri of the original request |
int |
m_user
Cache key variable: The user id |
String |
Resource
The OpenCms resource that this key is used for. |
String |
Variation
The cache behaviour description for the resource. |
| Constructor Summary | |
CmsFlexCacheKey(CmsFlexRequest request,
String target,
boolean online)
This constructor is used when building a cache key from a request. |
|
CmsFlexCacheKey(String target,
String cacheDirectives,
boolean online)
This constructor is used when building a cache key from set of cache directives. |
|
| Method Summary | |
static String |
getKeyName(String name,
boolean online)
Calculates the cache key name that is used as key in the first level of the FlexCache. |
boolean |
hadParseError()
This flag is used to indicate that a parse error had occured, which can happen if the cache directives String passed to the constructor using the response is not build according to the Flex cache language syntax. |
String |
matchRequestKey(CmsFlexCacheKey key)
Compares this key to the other key passed as parameter, from comparing the two keys, a variation String is constructed. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public String Resource
public String Variation
public int m_always
public String m_uri
public int m_user
public Set m_groups
public Map m_params
public Set m_noparams
public long m_timeout
public boolean m_publish
public Set m_schemes
public Set m_ports
| Constructor Detail |
public CmsFlexCacheKey(CmsFlexRequest request,
String target,
boolean online)
The request contains several data items that are neccessary to construct the output. These items are e.g. the Query-String, the requested resource, the current time etc. etc. All required items are saved in the constructed cache - key.
target - the requested resource in the OpenCms VFSonline - must be true for an online resource, false for offline resourcesrequest - the request to construct the key for
public CmsFlexCacheKey(String target,
String cacheDirectives,
boolean online)
These directives are attached to the properties of the requested resource on a property called "cache". The value of this poperty that is passed in this constructor as "cacheDirectives" is parsed to build the keys data structure.
In case a parsing error occures, the value of this key is set to "cache=never", and the hadParseError() flag is set to true. This is done to ensure that a valid key is always constructed with the constructor.
target - the requested resourcecacheDirectives - the cache directives of the resource (value of the property "cache")online - must be true for an online resource, false for offline resources| Method Detail |
public static String getKeyName(String name,
boolean online)
name - the name of the resourceonline - must be true for an online resource, false for offline resources
public boolean hadParseError()
public String matchRequestKey(CmsFlexCacheKey key)
This method is the "heart" of the key matching process.
The assumtion is that this key should be the one constructed for the response, while the parameter key should have been constructed from the request.
A short example how this works: If the resource key is "cache=groups" and the request is done from a guest user (which always belongs to the default group "guests"), the constructed variation will be "groups=(guests)".
key - the key to match this key with
public String toString()
toString in class ObjectObject.toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||