·
Last changedVersion:
This version passed the hardening gate. Hardening updated the skill content and independently checked the resulting changes. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 9. Review findings remaining: 1.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
Encore Go's cache is a typed wrapper around Redis. Declare a cache.Cluster once, then create Keyspace objects for each shape of data you need.
Eviction policies: cache.AllKeysLRU (default), cache.NoEviction, cache.AllKeysLFU, cache.AllKeysRandom, cache.VolatileLRU, cache.VolatileLFU, cache.VolatileTTL, cache.VolatileRandom.
Clusters holding rate limit counters or session state should use cache.NoEviction, a volatile policy with an expiry on every key, or a dedicated cluster, so that eviction under memory pressure keeps that state intact.
Each keyspace has a key shape (used to build the Redis key from KeyPattern) and a value type.
The examples above discard errors only for brevity. In real code, check every returned error from Set, Get, Delete, Increment and Decrement, and handle cache.Miss separately from other Get errors. Treat a failed Delete used to revoke a token as an error that must be handled.
All from encore.dev/storage/cache:
NewFloatKeyspace — float64 values, has Increment.NewListKeyspace — list values, with PushLeft/PushRight/PopLeft/PopRight/GetRange.NewSetKeyspace — set values, with Add/Remove/Contains/Items.Validate key fields taken from user input (reject the slash character) or encode or hash them before use, and take UserID from the authenticated identity rather than from request input, so that keys stay distinct and limits apply as intended.
For tokens or personal data, use a bounded expiry such as cache.ExpireIn instead of cache.NeverExpire or cache.KeepTTL.
This snippet also needs the standard errors package imported; ctx, key, value and keyspace are placeholders for your own values.
cache.Cluster and keyspaces as package-level variables.IntKeyspace for counters gives you atomic Increment/Decrement for free.Get() returns cache.Miss on miss; Replace() returns cache.Miss when the key is absent, and SetIfNotExists() returns cache.KeyExists when the key already exists.encore-go-database (Postgres) or encore-go-bucket (object storage) instead.Get started with chainctlchainctl skill install public/encoredev/go-cache:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.cgr.dev/public/github.com/encoredev/encore/go-cache:latest
Apache-2.0
HARDENING.md
LICENSE
SKILL.md