The SQL repository offers two different approaches to setting a maximum lifetime for items in the cache. Each of these approaches uses a timeout attribute in the item descriptor definition. The first approach uses the item-expire-timeout and query-expire-timeout attributes. Each of these attributes specifies the number of milliseconds that an entry can stay in the item cache or query cache before it needs to be refreshed. For example, if you set item-expire-timeout to 1000 milliseconds, the SQL repository will reload those properties after they have been in the cache for 1 second. If you set query-expire-timeout to 1000 milliseconds, the SQL repository re-executes the query after that entry has been in the query cache for 1 second.

To use the item-expire-timeout and query-expire-timeout attributes, set the value (in milliseconds) in the item-descriptor tag. For example:

<item-descriptor name="order" cache-mode="simple"
      item-expire-timeout="180000"
      query-expire-timeout="180000">
...
</item-descriptor>

Under the second approach, the SQL repository expires entries in the item cache when they have been unused for the specified amount of time. In this case, an item remains in the item cache as long as it is being accessed in this particular ATG instance before the time specified by the item-cache-timeout attribute for that item descriptor has elapsed. If an item has not been accessed for the duration of the item-cache-timeout value, then its entry in the item cache is invalidated. The default, 0, lets the item remain in the cache indefinitely until otherwise invalidated.

To use the item-cache-timeout attribute, set its value (in milliseconds) in the item-descriptor tag for item types that are associated with a particular user session. For example:

<item-descriptor name="order" cache-mode="simple"
                 item-cache-timeout="180000">
...
</item-descriptor>

In most cases, using the item-expire-timeout attribute will be preferable to using the item-cache-timeout attribute, since the item-cache-timeout approach is not suitable for certain types of data access.

You can use either of these cache timeout approaches as an alternative to using the locked cache mode. You can use cache timeout attributes together with simple cache mode to control the behavior of the repository caches. The cache timeout attributes are useful for caching user data associated with a particular session. A user’s session is typically handled by a single ATG server for as long as the session lasts. If a user’s session expires, and then the user moves to another ATG server, the cached data will expire before the user has a chance to log back in to a server that might have previously cached stale data for that user. This attribute is also a means to reduce a system’s memory requirements by removing cached items that are no longer being accessed.

 
loading table of contents...