Golang Samber Hot
context-labs/whip
In-memory caching in Go using samber/hot — eviction (LRU, LFU, TinyLFU, S3FIFO, ARC, SIEVE), TTL, loaders, sharding, stale-while-revalidate, missing-key caching, metrics.
In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing…
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install samber/cc-skills-golang golang-samber-hot --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/golang-samber-hot .claude/skills/golang-samber-hot && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .claude/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hotType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install samber/cc-skills-golang golang-samber-hot --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/golang-samber-hot .agents/skills/golang-samber-hot && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .agents/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install samber/cc-skills-golang golang-samber-hot --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/golang-samber-hot .cursor/skills/golang-samber-hot && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .cursor/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/samber/cc-skills-golang.git --path skills/golang-samber-hot--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install samber/cc-skills-golang golang-samber-hot --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/golang-samber-hot .gemini/skills/golang-samber-hot && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .gemini/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install samber/cc-skills-golang golang-samber-hotInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/golang-samber-hot .github/skills/golang-samber-hot && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .github/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add samber/cc-skills-golang --skill golang-samber-hot -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install samber/cc-skills-golang golang-samber-hot --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/samber/cc-skills-golang.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/golang-samber-hot .opencode/skills/golang-samber-hot && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "golang-samber-hot" agent skill from https://github.com/samber/cc-skills-golang/tree/main/skills/golang-samber-hot into .opencode/skills/golang-samber-hot/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-samber-hot", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
golang-samber-hotIn-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing…
Golang Samber Hot is an agent skill from samber/cc-skills-golang. In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing key caching, and Prometheus metrics. Apply when using or adopting samber/hot, when the codebase imports github.com/samber/hot, or when the project repeatedly loads the same medium-to-low cardinality resources at high frequency and needs to reduce latency or backend pressure.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `evals/evals.json`, `references/algorithm-guide.md` and `references/api-reference.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
It sits in DevOps & Cloud, covering Caching, Monitoring and alerting and Database administration. It works with Go, GitHub and Prometheus. The repository describes itself as: 🧑🎨 A collection of Golang agentic skills that works. The licence is MIT.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 8e899e2. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadEditWriteGlobGrepBash(go:*)Bash(golangci-lint:*)Bash(git:*)AgentWebFetch…and 7 more on the same allowed-tools line.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
goFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
github.compkg.go.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
From compatibility in the SKILL.md frontmatter.
Golang Samber Hot loads about 2k tokens when it runs, and up to ~7.9k if it reads all its reference files. Until then it costs about 123 tokens; SKILL.md has 712 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from samber/cc-skills-golang at commit 8e899e2, republished under its MIT licence (© samber). 712 words, ~1,982 tokens.
.claude/skills/golang-samber-hot/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.Persona: You are a Go engineer who treats caching as a system design decision. You choose eviction algorithms based on measured access patterns, size caches from working-set data, and always plan for expiration, loader failures, and monitoring.
Generic, type-safe in-memory caching library for Go 1.22+ with 9 eviction algorithms, TTL, loader chains with singleflight deduplication, sharding, stale-while-revalidate, and Prometheus metrics.
Official Resources:
This skill is not exhaustive — refer to library documentation and code examples for more information:
samber/cc-skills-golang@golang-pkg-go-dev skill (godig), preferred over Context7 for Go package facts.samber/cc-skills-golang@golang-gopls skill (gopls).go get -u github.com/samber/hotPick based on your access pattern — the wrong algorithm wastes memory or tanks hit rate.
| Algorithm | Constant | Best for | Avoid when |
|---|---|---|---|
| W-TinyLFU | hot.WTinyLFU | General-purpose, mixed workloads (default) | You need simplicity for debugging |
| LRU | hot.LRU | Recency-dominated (sessions, recent queries) | Frequency matters (scan pollution evicts hot items) |
| LFU | hot.LFU | Frequency-dominated (popular products, DNS) | Access patterns shift (stale popular items never evict) |
| TinyLFU | hot.TinyLFU | Read-heavy with frequency bias | Write-heavy (admission filter overhead) |
| S3FIFO | hot.S3FIFO | High throughput, scan-resistant | Small caches (<1000 items) |
| ARC | hot.ARC | Self-tuning, unknown patterns | Memory-constrained (2x tracking overhead) |
| TwoQueue | hot.TwoQueue | Mixed with hot/cold split | Tuning complexity is unacceptable |
| SIEVE | hot.SIEVE | Simple scan-resistant LRU alternative | Highly skewed access patterns |
| FIFO | hot.FIFO | Simple, predictable eviction order | Hit rate matters (no frequency/recency awareness) |
Decision shortcut: Start with hot.WTinyLFU. Switch only when profiling shows the miss rate is too high for your SLO.
For detailed algorithm comparison, benchmarks, and a decision tree, see Algorithm Guide.
import "github.com/samber/hot"
cache := hot.NewHotCache[string, *User](hot.WTinyLFU, 10_000).
WithTTL(5 * time.Minute).
WithJanitor().
Build()
defer cache.StopJanitor()
cache.Set("user:123", user)
cache.SetWithTTL("session:abc", session, 30*time.Minute)
value, found, err := cache.Get("user:123")Loaders fetch missing keys automatically with singleflight deduplication — concurrent Get() calls for the same missing key share one loader invocation:
cache := hot.NewHotCache[int, *User](hot.WTinyLFU, 10_000).
WithTTL(5 * time.Minute).
WithLoaders(func(ids []int) (map[int]*User, error) {
return db.GetUsersByIDs(ctx, ids) // batch query
}).
WithJanitor().
Build()
defer cache.StopJanitor()
user, found, err := cache.Get(123) // triggers loader on missBefore setting the cache capacity, estimate how many items fit in the memory budget:
capacity = memoryBudget / estimatedItemSize. Round down to leave headroom.Example: *User struct ~500 bytes + string key ~50 bytes + overhead ~100 bytes = ~650 bytes/entry
256 MB budget → 256_000_000 / 650 ≈ 393,000 itemsIf the item size is unknown, ask the developer to measure it with a unit test that allocates N items and checks runtime.ReadMemStats. Guessing capacity without measuring leads to OOM or wasted memory.
WithJanitor() — without it, expired entries stay in memory until the algorithm evicts them. Always chain .WithJanitor() in the builder and defer cache.StopJanitor().SetMissing() without missing cache config — panics at runtime. Enable WithMissingCache(algorithm, capacity) or WithMissingSharedCache() in the builder first.WithoutLocking() + WithJanitor() — mutually exclusive, panics. WithoutLocking() is only safe for single-goroutine access without background cleanup.Get() returns (zero, false, err) on loader failure. Always check err, not just found.WithJitter(lambda, upperBound) to spread expirations — without jitter, items created together expire together, causing thundering herd on the loaderWithPrometheusMetrics(cacheName) — hit rate below 80% usually means the cache is undersized or the algorithm is wrong for the workloadWithCopyOnRead(fn) / WithCopyOnWrite(fn) for mutable values — without copies, callers mutate cached objects and corrupt shared stateFor advanced patterns (revalidation, sharding, missing cache, monitoring setup), see Production Patterns.
For the complete API surface, see API Reference.
If you encounter a bug or unexpected behavior in samber/hot, open an issue at https://github.com/samber/hot/issues.
samber/cc-skills-golang@golang-performance skill for general caching strategy and when to use in-memory cache vs Redis vs CDNsamber/cc-skills-golang@golang-observability skill for Prometheus metrics integration and monitoringsamber/cc-skills-golang@golang-database skill for database query patterns that pair with cache loaderssamber/cc-skills@promql-cli skill for querying Prometheus cache metrics via CLI© samber, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 4 other files (references) in skills/golang-samber-hot of samber/cc-skills-golang.
Open the folder on GitHubat commit 8e899e2
Golang Samber Hot next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Golang Samber Hot this skillsamber/cc-skills-golang | 3.4k | — | ~2k | Automated safety check: Pass | MIT | |
| Golang Samber Hotcontext-labs/whip | 1.1k | — | ~1.9k | Automated safety check: Pass | MIT | |
| Devnet Triagegeanlabs/gean | 177 | — | ~3.7k | Automated safety check: Warn | MIT | |
| Golang Observabilitycontext-labs/whip | 1.1k | 1 repos | ~3.3k | Automated safety check: Pass | MIT | |
| Golang Benchmarkaiskillstore/marketplace | 433 | 1 repos | ~3.4k | Automated safety check: Pass | MIT | |
| Greptimedb Perses DashboardGreptimeTeam/dashboard | 111 | — | ~3.9k | Automated safety check: Pass | Apache-2.0 |
context-labs/whip
In-memory caching in Go using samber/hot — eviction (LRU, LFU, TinyLFU, S3FIFO, ARC, SIEVE), TTL, loaders, sharding, stale-while-revalidate, missing-key caching, metrics.
geanlabs/gean
Diagnose a live, running lean devnet from its Prometheus and container logs, then report findings with proposed fixes and stop for approval.
context-labs/whip
Go observability — always-on production signals: slog logging, Prometheus metrics, OpenTelemetry tracing, pprof profiling, alerting, Grafana.
aiskillstore/marketplace
Golang benchmarking, profiling, and performance measurement.
GreptimeTeam/dashboard
Generate Perses dashboards or single panels for GreptimeDB. An agent skill from GreptimeTeam/dashboard.
thkhxm/tgf
基于 tgf v2(github.com/thkhxm/tgf/v2)用确定性的 tgfctl 工作流创建、验证和维护 Go 游戏服务器项目。
samber/cc-skills-golang
GitHub Actions CI/CD pipeline configuration for Golang projects — workflow files for test, lint, SAST, coverage and vulnerability-scan jobs, Dependabot and Renovate config files, GoReleaser release…
samber/cc-skills-golang
Comprehensive guide for dependency injection (DI) in Golang.
samber/cc-skills-golang
Dependency management for Golang projects — go.mod and go.sum, go get install and upgrade flows, Minimal Version Selection, conflict resolution with replace/exclude/retract, govulncheck scanning of…
samber/cc-skills-golang
Troubleshoot Golang programs systematically - find and fix the root cause.
samber/cc-skills-golang
Monadic types for Golang using samber/mo — Option, Result, Either, Future, IO, Task, and State types for type-safe nullable values, error handling, and functional composition with pipeline…
Works with
Categories
In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing…. Golang Samber Hot is an agent skill from samber/cc-skills-golang. In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing key caching, and Prometheus metrics.
Golang Samber Hot fits situations like: tasks that involve Caching; tasks that involve Monitoring and alerting; tasks that involve Database administration.
Run `npx skills add samber/cc-skills-golang --skill golang-samber-hot -a claude-code`. Or copy the skill folder (skills/golang-samber-hot in samber/cc-skills-golang) into .claude/skills/golang-samber-hot in your project. Claude Code loads it when a task matches its description.
Run `npx skills add samber/cc-skills-golang --skill golang-samber-hot -a codex`. Or copy the skill folder (skills/golang-samber-hot in samber/cc-skills-golang) into .agents/skills/golang-samber-hot in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add samber/cc-skills-golang --skill golang-samber-hot -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-samber-hot, .gemini/skills/golang-samber-hot, .github/skills/golang-samber-hot and .opencode/skills/golang-samber-hot in your project.
Going by SKILL.md and its folder, Golang Samber Hot needs the command-line tools its instructions call (go). Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang..
SKILL.md names 2 domains. As links in the text: github.com and pkg.go.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Golang Samber Hot is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.9k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Golang Samber Hot: Golang Samber Hot (context-labs/whip, 1.1k stars), Devnet Triage (geanlabs/gean, 177 stars), Golang Observability (context-labs/whip, 1.1k stars) and Golang Benchmark (aiskillstore/marketplace, 433 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
samber (a GitHub user) maintains it in samber/cc-skills-golang, which has 3,432 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 1, 2026.
Source: samber/cc-skills-golang on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.