HCL Commerce Version 9.1.9.0

Configuring HCL Cache options

Custom caches using the default hcl-cache provider can be configured with additional options.

HCL Caches enable local and remote caching by default. Custom caches can also be configured to use only local, or only remote configurations.

Local-only cache
Use local-only caches for objects that are not serializable. Local-only caching can also be preferred for objects that grow unbounded and have poor re-usability, such as search results. By using only local caching you avoid the additional overhead for network and memory maintenance incurred by remote caching.
Remote-only cache
Remote-only caches are only stored in the remote Redis server and do not require invalidations to be replicated to each local server. This can be preferable for frequently changing data, where high volumes of invalidation messages can sometimes cause stale cached data to be used due to slower message processing.

When local caching is used, the HCL Cache automatically enables publish and subscribe of invalidation messages.

configuration are defined in the HCL Cache configuration map as in the following example:
<?xml version="1.0" encoding="UTF-8"?>

<server>
apiVersion: v1
data:
  cache_cfg-ext.yaml: |-
    # cache_cfg-ext.yaml content read from values
    redis:
      enabled: true
      yamlConfig: "/SETUP/hcl-cache/redis_cfg.yaml" # Please leave this line untouched
      circuitBreaker:
        scope: client	
    cacheConfigs:
      services/cache/MyRemoteOnlyCustomCache1:
        localCache:
          enabled: false
      services/cache/MyLocalOnlyCustomCache1:
        remoteCache:
          enabled: false

HCL Cache also allows each cache entry to optionally specify that it should not be cached either in the local cache or in the remote cache. If the cache id contains “hcl-cache:skip-remote”, then the entry will not be cached in the remote cache. Similarly, if the cache id contains “hcl-cache:skip-local”, then the entry will not be cached in the local cache.

For use in DynaCache cachespec.xml configuration files, these special strings are available as HTTP request attributes, named DC_HclCacheSkipRemote and DC_HclCacheSkipLocal respectively. They can be used to help construct cache ids in the cachespec.xml file, like this:
<component id=”DC_HclCacheSkipRemote” type=”attribute”>
<required>true</required>
</component>