The algorithm used for creating cache keys is specified through a class that implements the atg.search.routing.CacheKeyCreator interface. This interface has a single makeKey() method for creating cache keys from the requests.

Oracle ATG Web Commerce Search includes two components whose classes implement CacheKeyCreator:

To specify the component to use for creating cache keys, set the cacheKeyCreator property of the /atg/search/routing/RoutingSearchService component. For example, to enable hashing of cache keys, set cacheKeyCreator to the DigestCacheKeyCreator component:

cacheKeyCreator=/atg/search/routing/DigestCacheKeyCreator

With this setting, each cache key is created by performing an MD5 hash of the corresponding XML request and converting the result to a 24-character string.

If cacheKeyCreator is not set, /atg/search/routing/DefaultCacheKeyCreator is used to create the cache keys from the uncompressed XML requests. By default, cacheKeyCreator is not set.

Note that if you change the value of cacheKeyCreator, you should clear the cache, since any existing cache keys will not match the keys generated from new requests.

Tradeoffs

Hashing a request can result in huge space savings, because the resulting cache key is always only 24 characters long. However, there is a small increase in CPU usage associated with performing the hash, both for caching and for cache lookups.

A hash value is not necessarily unique to a specific request, so there is a very slight chance of a cache key collision. If this happens, the incorrect response may be returned.