Configuring the policy caches

MCS uses caching in order to avoid accessing the repository for policies that have been retrieved recently. All variants are cached with their containing policies.

MCS uses caching in order to avoid accessing the repository for policies that have been retrieved recently. All variants are cached with their containing policies.

You can configure caching in the policy-cache section of the mcs-config.xml file by setting global cache values to optimize performance.

<policy-cache>
  <asset-group-cache
    enabled="true"
    max-entries="25"
    timeout="3600"/>
</policy-cache>

Setting cache attributes

You define cache settings by editing policy-cache attribute values. You can set up values for each type of object, and then switch them on or off with the enabled attribute. On a production server you should set all policy caches to 'true'; on a development server you may wish to switch off some caches so that any changes you make to content are effective immediately.

Each item in the cache has a count that is incremented when MCS accesses the object, and a record of the time of last access. MCS always removes the 10 least recently used items.

The max-entries attribute defines the default number of entries in each cache. If you don't specify a value, or set it to '-1', no size limit is set. Asset groups, images and layouts may need the most space in the policy cache, whereas themes may require a relatively smaller cache. For devices, remember to allow for growth in the device repository.

When an item is requested from the cache MCS checks the timeout attribute, which specifies the default number of seconds an item can remain in the cache. If the item has timed out, MCS removes it from the cache and requests the item from the repository. The new item is then cached. This means that, although items may have timed out, they will still exist in the cache until accessed.

You can use the timeout feature to force the cache to update items which may have changed in the repository during run time. It is not intended as a device for resizing the cache after a certain time period. If you don't specify a timeout value, or set it to -1, a cache will be created where none of the items timeout.

Factors affecting cache size

There is no exact formula for calculating the size of a cache. There is one cache entry for each policy, and each policy includes all the variants in a policy, and the variants selected for each device. Also the size of the cache depends on the number of requests for the individual policies. Layout and theme policies take the most space, as well as being the most frequently requested. Otherwise cache entries are quite small, so increasing the setting of max-entries attribute value will not use large amounts of memory.

Related topics