Use of cache directives
The use of cache directives extends the cache configuration to allow instructions to be applied at the cache entry level. Cache directives are disabled by default except for the baseCache as follows:
baseCache:
enableDirectives: true
skip-local
and skip-remote
directives
The skip-local
and skip-remote
directives instruct the
to not use the local or remote cache for this particular
cache-ID. The directive must be included within the cache-ID as follows:
- hcl-cache:skip-remote
put
andget
operations for this cache-id as done only on the local cache.- hcl-cache:skip-local
put
andget
operations for this cache-id as done only on the remote cache.
These directives serve a specific use case where a cache enables both local and remote cache but there is a preference for specific cache-IDs to use only one cache. For example, in cases of cache-entries with low reusability, you might choose to disable remote caching.
9.1.10+ includes Inactivity maintenance, which can be enabled in the Remote Cache to discard cache entries that are not seeing reuse. This enables efficient use of the remote cache, and remote caching might not need to be disabled.
Use of skip-local and skip-remote directives in cachespec.xml
The skip-local
and skip-remote
directives can be
specified in cachespec.xml by referring the matching request
attribute:
- DC_HclCacheSkipRemote
- A special attribute that instructs the not to use remote cache for this entry even when enabled for the cach
- DC_HclCacheSkipLocal
- A special attribute that instructs the not to use local cache for this entry even when enabled for the cache.
For caches that enable directives, cache entries that include the respective attributes will bypass local or remote caching as specified:
<component id="DC_HclCacheSkipRemote" type="attribute">
<required>true</required>
</component>