One-click install
npx skills add https://github.com/adibfirman/dotfiles --skill golang-samber-hot-adibfirman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-hot
Source: https://github.com/adibfirman/dotfiles/tree/main/claude/.claude/skills/technical/golang/golang-samber-hot
Command: npx skills add https://github.com/adibfirman/dotfiles --skill golang-samber-hot-adibfirman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design effective in-memory caching with samber/hot in Go so you reduce latency and backend pressure while handling TTL expiration, loader failures, and monitoring.

Core Features & Use Cases

  • Eviction algorithm selection: Choose the right eviction strategy (e.g., W-TinyLFU, LRU, LFU, ARC, S3FIFO, SIEVE) based on access patterns such as mixed recency/frequency, stable frequency, or scan-heavy workloads.
  • Production-ready cache behavior: Configure TTL, jitter, singleflight loader deduplication via loaders, stale-while-revalidate, missing key caching, sharding, and copy-on-read/write for mutable values.
  • Observability and operational safety: Enable Prometheus metrics, plan for janitor/cleanup, and avoid common runtime pitfalls like missing cache configuration for SetMissing.

Quick Start

Use the golang-samber-hot skill to set up a samber/hot cache with W-TinyLFU, a 10-minute TTL, background janitor cleanup, and a loader that batches database lookups on cache misses.

Frequently Asked Questions about golang-samber-hot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right cache eviction algorithm in Go for my access patterns?

To configure stale-while-revalidate in Go in-memory caching, set a TTL with jitter and use a loader function that serves stale data while fetching fresh values in the background. This reduces latency and backend load during cache refreshes.

How do I prevent cache stampede in Go services using loaders?

To expose Prometheus metrics for Go in-memory caching, instrument your cache with hit, miss, and latency tracking. Configure the WithJanitor cleanup lifecycle and monitor eviction rates to validate your capacity sizing and algorithm choice.

How do I handle mutable cached values safely in Go in-memory caches?

To handle mutable cached values safely in Go in-memory caches, apply copy-on-read and copy-on-write patterns. This prevents race conditions when multiple goroutines access or modify the same cached object concurrently.

What are the limitations of in-memory caching for high-cardinality Go resources?

To handle loader error handling and negative caching in Go, cache missing keys with SetMissing to prevent repeated backend queries for non-existent data. Implement robust error handling in your loader to avoid caching failed responses.