Custom HCL Cache configuration

Configure custom cache settings by using the cache_cfg-ext.yaml file to override default values or define new cache behaviors. This file is stored in Kubernetes configuration maps and merges with the default configuration during processing.

Settings in the custom configuration file, which shares the same format as the default configuration file, override settings in the default configuration file.

For more information about the caching defaults stored in Kubernetes, see the sample Configuration.md file stored in the HCL Commerce Github repository.

Important: The custom cache configuration file (cache_cfg-ext.yaml) is merged with the default configuration file and allows the overriding of default configurations. If you are customizing an existing cache, include the complete cache definition in the custom configuration file.

Modify or extend the function of the HCL Cache by making changes to this file. Required or other default settings which are not present in this file will fall back to their values that are found in the default configuration file.

  • Cache_cfg-ext.yaml file changes:
    # cache_cfg-ext.yaml content read from values
    redis:
    enabled: true
    yamlConfig: "/SETUP/hcl-cache/redis_cfg.yaml" # Please leave this line untouched
    cacheConfigs:
      services/cache/WCSessionDistributedMapCache:
        localCache:
          enabled: true
  • configMaps values:
    apiVersion: v1
    # content for cache_cfg-ext.yaml
        cache_cfg_ext: |-
          redis:
            enabled: true
            yamlConfig: "/SETUP/hcl-cache/redis_cfg.yaml" # Please leave this line untouched
          # Cache configurations
          cacheConfigs:
            # Default configuration enables local and remote caching
            # See defaultCacheConfig in /SETUP/hcl-cache/cache_cfg.yaml for the out-of-the-box 
            # default configuration.
            # The following custom configurations extend and override the definitions in the
            # /SETUP/hcl-cache/cache_cfg.yaml file.
            services/cache/SampleCustomLocalOnlyCache:
              remoteCache:
                enabled: false
            services/cache/SampleCustomRemoteOnlyCache:
              localCache:
                enabled: false
        
Review the default HCL Cache configuration file reference to make your customizations.
Note: Share, Live and Auth are the three configuration maps; always synchronize changes between these maps.