Skip to content

docs: rewrite custom-cache example to demonstrate offline-fallback semantics (KSM-920) - #67

Merged
stas-schaller merged 1 commit into
release/sdk/golang/core/v1.7.0from
KSM-920-custom-cache-example
Apr 30, 2026
Merged

docs: rewrite custom-cache example to demonstrate offline-fallback semantics (KSM-920)#67
stas-schaller merged 1 commit into
release/sdk/golang/core/v1.7.0from
KSM-920-custom-cache-example

Conversation

@stas-schaller

Copy link
Copy Markdown
Contributor

Summary

The previous example/custom-cache/main.go claimed the second GetSecrets call within the TTL window was "served from cache, no API request." The Go SDK does not implement pre-call cache lookups — ICache is an offline resilience mechanism. Every GetSecrets call contacts the API; the cache is only consulted when the API returns non-200 or the request fails at the network layer.

This PR rewrites the example to demonstrate what the cache actually does now that KSM-921 is on the release branch:

  • Call 1: normal request → API responds 200 → SaveCachedValue called → cache populated
  • Call 2: client pointed at keepersecurity.invalid (NXDOMAIN) → KSM-921 fallback fires → cached records returned, warning logged
  • Call 3: cache.Purge() + same broken host → no cached data → original network error surfaces

The package docstring, inline comments, README Custom Cache section, and CHANGELOG Documentation entry are all updated to describe offline-fallback semantics accurately.

Related Issues

Closes KSM-920
Part of v1.7.0 release (PR #51)

…mantics (KSM-920)

The previous example claimed the second GetSecrets call within the TTL
window was "served from cache, no API request." The Go SDK does not
implement pre-call cache lookups — ICache is an offline resilience
mechanism, not a request-rate limiter.

Rewrite main.go to demonstrate what the cache actually does (enabled by
KSM-921 now also landing on this branch):
  - Call 1: normal API request populates the cache
  - Call 2: unreachable hostname (NXDOMAIN) triggers KSM-921 fallback,
    cached records returned, warning logged
  - Call 3: Purge() + unreachable host → original network error surfaces

Package docstring, inline comments, README Custom Cache section, and
CHANGELOG Documentation entry updated to describe offline-fallback
semantics rather than TTL hit/miss semantics.

Closes KSM-920
@stas-schaller
stas-schaller merged commit a7c4058 into release/sdk/golang/core/v1.7.0 Apr 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant