Caching and Redis client configurations for HCL Cache
The HCL Cache is configured via a set of files that define the configurations for each cache, and the Redis connection information.
File | Location | Usage |
---|---|---|
/SETUP/hcl-cache/redis_cfg.yaml | Config Map | Redis client connection information |
/SETUP/hcl-cache/cache_cfg.yaml | Container | Provided by default and present on all containers that use HCL Cache. It contains default and preset configurations and must not be modified |
/SETUP/hcl-cache/cache_cfg-ext.yaml | Config Map | You can create this file to extend and override the configuration in cache_cfg.yaml. This file has the same format as cache_cfg.yaml |
- Redis client configuration
- The Redis client connection information is stored in redis_cfg.yaml. This file contains details about the topolgy (standalone, cluster, etc), the connection information (hostname, TLS, authentication), pools and timeouts. See Redis Client Configuration for details.
- Cache configurations
- Caches are configured in two main files:
cache_cfg.yaml
exists on all contains and defines default values. Specific values for default caches, andcache_cfg-ext.yaml
can be used to update defaults or set new configurations for custom caches. See: Cache Configuration.
Configurations in Kubernetes
For the customizable files cache_cfg-ext.yaml and redis_cfg.yaml, the HCL Cache uses a technique whereby the contents of the files are stored in Kubernetes Configuration Maps (configmaps). This allows for updates to be made without having to create custom images for each environment, as for example the Redis hostname might be different from environment to environment. Pods are configured to load the config map during initialization and make its contents available as regular files.
- Configurations in Helm
- The configmaps are originally created during installation of
the Helm chart. The original values are defined in the HCL Cache
section of values.yaml. These values can be updated as required.
To update the configuration, the recommended approach is to update the chart, and perform Helm Update. If the configmap is updated directly, pods must be manually restarted to load the updated values.hclCache: configMap: cache_cfg_ext: |- redis: enabled: true yamlConfig: "/SETUP/hcl-cache/redis_cfg.yaml" # Please leave this line untouched cacheConfigs: ... redis_cfg: |- singleServerConfig: ...
Note: Change to one release (auth/ share/ live) might need to be repicated to the others.
- Validating the current client configuration
- After installation, you can inspect the contents of the
configmap as follows:
kubectl get configmap -n commerce NAME DATA AGE demo-qa-auth-demoqa-hcl-cache-config 2 15d demo-qa-live-demoqa-hcl-cache-config 2 15d demo-qa-share-demoqa-hcl-cache-config 2 15d
kubectl describe configmap -n commerce demo-qa-auth-demoqa-hcl-cache-config kubectl edit configmap -n commerce demo-qa-auth-demoqa-hcl-cache-config