docs.roxen.comBack to normal mode
DocsRoxen2.2Web Site Creator ManualProgramming Tags
Copyright © 2004, Roxen Internet Software
Suggestions, comments & compliments
manuals@roxen.com

<cache></cache>

Provided by module: Tags: RXML 2 tags

This tag caches the evaluated result of its contents. When the tag is encountered again in a later request, it can thus look up and return that result without evaluating the content again.

Nested <cache> tags are normally cached separately, and they are also recognized so that the surrounding tag doesn't cache their contents too. It's thus possible to change the cache parameters or completely disable caching of a certain part of the content inside a <cache> tag.

Note!

This implies that any RXML tags that surrounds the inner <cache> tag(s) won't be cached.

Besides the value produced by the content, all assignments to RXML variables in any scope are cached. I.e. an RXML code block which produces a value in a variable may be cached, and the same value will be assigned again to that variable when the cached entry is used.

When the content is evaluated, the produced result is associated with a key that is built by taking the values of certain variables and other pieces of data, which thus are what the cache depends on. The arguments "variable", "key" and "profile" lets you specify the cache dependencies.

Note!

It is easy to create huge amounts of cached values if the cache parameters are chosen badly. E.g. to depend on the contents of the form scope is typically only acceptable when combined with a fairly short cache time, since it's otherwise easy to fill up the memory on the server simply by making many requests with random variables.

The cache can be shared between all <cache> tags with identical content, which is typically useful in <cache> tags used in templates included into many pages. The drawback is that cache entries stick around when the <cache> tags change and that the cache won't be persistent (see below). Only shared caches have any effect if the RXML pages aren't compiled and cached.

If the page is compiled to p-code which is saved, and the cache is not shared, and there is no timeout on it, then the produced cache entries are also saved, and the cache is thus persistent. In this case it's thus especially important to limit the number of alternative cache entries.

Compatibility note: If the compatibility level of the site is lower than 2.2 and there are no "variable" or "profile" arguments, the cache depends on the contents of the form scope and the path of the current page (i.e. &page.path;). This is often a bad policy since it's easy for a client to generate many cache entries.


Attributes

variable="string"

This is a comma-separated list of variables and scopes that the cache should depend on. The value can be an empty string, which is useful to only disable the default dependencies in compatibility mode.

Since it's important to keep down the size of the cache, this should typically be kept to only a few variables with a limited set of possible values, or else the cache should have a timeout.


key="string"

Use the value of this attribute directly in the key. This attribute mainly exist for compatibility; it's better to use the "variable" attribute instead.

It is an error to use "key" together with "propagate", since it wouldn't do what you'd expect: The value for "key" would not be reevaluated when an entry is chosen from the cache, since the nested, propagating <cache> isn't reached at all then.


profile="string"

A comma-separated list to choose one or more profiles from a set of preconfigured cache profiles. Which cache profiles are available depends on the RXML parser module in use; the standard RXML parser currently has none.


shared

Share the cache between different instances of the <cache> with identical content, wherever they may appear on this page or some other in the same server. See the tag description for details about shared caches.


nocache

Do not cache the content in any way. Typically useful to disable caching of a section inside another cache tag.


propagate

Propagate the cache settings to the surrounding <cache> tag, if there is any. Useful to locally add depends to a cache without introducing a new cache level. If there is no surrounding <cache> tag, this argument is ignored.


nohash

If the cache is shared, then the content won't be made part of the cache key. Thus the cache entries can be mixed up with other <cache> tags.


not-post-method

By adding this attribute all HTTP requests using the POST method will be unaffected by the caching. The result will be calculated every time, and the result will not be stored in the cache. The contents of the cache will however remain unaffected by the POST request.


flush-on-no-cache

If this attribute is used the cache will be flushed every time a client sends a pragma no-cache header to the server. These are e.g. sent when shift+reload is pressed in Netscape Navigator.


years="number"

Add this number of years to the time this entry is valid.


months="number"

Add this number of months to the time this entry is valid.


weeks="number"

Add this number of weeks to the time this entry is valid.


days="number"

Add this number of days to the time this entry is valid.


hours="number"

Add this number of hours to the time this entry is valid.


beats="number"

Add this number of beats to the time this entry is valid.


minutes="number"

Add this number of minutes to the time this entry is valid.


seconds="number"

Add this number of seconds to the time this entry is valid.