Logic Tags
Tag sessioncache


This tag provides caching of data set by data tags. The difference between this tag the other cache tag, appcache tag, is that this tag caches data on a per user basis and the data is cleared after a user logs off, while the appcache tag caches data shared between multiple users and persists across user sessions.
Typical use of this tag would be to cache user specific data such as User Info data or custom properties added to users.
Note that most data tags do not need to be cached. Data tags in the ptdata tag library already use server-side cached data. Suitable data tags to cache are ones that execute database or search queries every time they run. For example custom properties on a Community that every user has access to.
To cache a data tag, define it normally and then nest it inside of the cache tag. Then set the data and datascope attributes of the cache tag with the data key and data scope of the data tag. On the cache tag, define expiration duration for the cache entries and a contextid. To cache data in a Community, pass in current Community id as the contextid value. For a page, use the Page id.

Example:
<pt:logic.sessioncache pt:cachekey="cacheddata" pt:expiration="20" pt:data="datatocache" >
  <pt:custom.customquery pt:key="datatocache"/> // this tag is only run when cached data expired or none is found
</pt:logic.sessioncache>

<pt:logic.value pt:value="$cacheddata" pt:scope="session"> // accessing the cached data


Tag Information
Tag Namesessioncache

Attributes
NameTypeRequiredDefault ValueDescription
cachekeystringfalsenullSpecify a custom cache key. By default the dataid is used as cachekey. Custom cachekeys is only needed to prevent cachekey conflicts.
contextidstringfalsenullA value representing the current context. Current Community id to cache data for a specific Community, or current Page id to cache Page data for a user. It is also possible to combine two or more ids as a contextid to create custom context. For example combining current Community id and Experience Definition id caches data only for users in this Community and Experience Definition. Do not include User id in the contextid; the logic.sessioncache tag caches per user by definition.
expirationinttruenullNumber of minutes to cache an entry before rerunning the data tag to refresh the data.
datastringtruenullName of the tag variable where the data tag to cache sets its data. Should be same as the pt:key attribute in the enclosed data tag.
datascopestringfalseportlet requestScope of the data tag variable id.


Copyright 2005 Plumtree Software, Inc.