|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.flex.CmsFlexCacheKey
public class CmsFlexCacheKey
Implements the CmsFlexCacheKey, which is a key used to describe the caching behaviour of a specific resource.
It has a lot of variables that are directly accessed (which isn't good style, I know) to avoid method calling overhead (a cache is about speed, isn't it :).
Constructor Summary | |
---|---|
CmsFlexCacheKey(java.lang.String resourcename,
java.lang.String cacheDirectives,
boolean online)
This constructor is used when building a cache key from set of cache directives. |
Method Summary | |
---|---|
static java.lang.String |
getKeyName(java.lang.String resourcename,
boolean online)
Calculates the cache key name that is used as key in the first level of the FlexCache. |
protected java.lang.String |
getResource()
Returns the resource. |
protected long |
getTimeout()
Returns the timeout. |
protected java.lang.String |
getVariation()
Returns the variation. |
boolean |
hadParseError()
This flag is used to indicate that a parse error had occurred, 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. |
java.lang.String |
matchRequestKey(CmsFlexRequestKey key)
Compares this key to the other key passed as parameter, from comparing the two keys, a variation String is constructed. |
protected void |
setVariation(java.lang.String variation)
Sets the variation. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CmsFlexCacheKey(java.lang.String resourcename, java.lang.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.
resourcename
- the full name of the resource including site rootcacheDirectives
- the cache directives of the resource (value of the property "cache")online
- must be true for an online resource, false for offline resourcesMethod Detail |
---|
public static java.lang.String getKeyName(java.lang.String resourcename, boolean online)
resourcename
- the full name of the resource including site rootonline
- must be true for an online resource, false for offline resources
public boolean hadParseError()
public java.lang.String matchRequestKey(CmsFlexRequestKey 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 cache key is "cache=user" and the request is done from a guest user the constructed variation will be "user=(guest)".
key
- the key to match this key with
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
protected java.lang.String getResource()
protected long getTimeout()
protected java.lang.String getVariation()
protected void setVariation(java.lang.String variation)
variation
- the variation to set
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |