golang-samber-hot

Configure samber/hot in-memory caching with eviction algorithms, TTL policies, and loaders.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/dashkan/pivox --skill golang-samber-hot-dashkan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-hot
Source: https://github.com/dashkan/pivox/tree/main/.agents/skills/golang-samber-hot
Command: npx skills add https://github.com/dashkan/pivox --skill golang-samber-hot-dashkan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design and implement high-performance in-memory caching in Go with correct eviction, TTL expiration, and safe loader behavior to reduce backend load and latency.

Core Features & Use Cases

  • Eviction algorithm selection: Choose the right strategy (W-TinyLFU, LRU, LFU, TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO) based on access patterns to maximize hit rate.
  • TTL and production hardening: Configure TTL, optional jitter, and background janitor cleanup to prevent stale data from lingering.
  • Loader patterns and operational safety: Use WithLoaders for read-through caching with built-in singleflight deduplication, plus stale-while-revalidate via WithRevalidation.
  • Concurrency and correctness: Apply sharding to reduce contention and use Copy-on-Read/Write when cached values are mutable pointers/slices/maps.
  • Monitoring and capacity planning: Enable Prometheus metrics and size caches using working-set/memory budget guidance.

Quick Start

Use the golang-samber-hot skill to configure a samber/hot cache with W-TinyLFU, a TTL, janitor cleanup, and a loader that batch-fetches missing keys while deduplicating concurrent requests.

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 Go in-memory cache eviction algorithm for my access patterns?

Selecting the right Go in-memory cache eviction algorithm depends on access patterns: W-TinyLFU and TinyLFU suit scan-heavy workloads, while LRU, LFU, ARC, S3FIFO, TwoQueue, SIEVE, and FIFO fit distinct frequency and recency profiles to maximize hit rates.

How do I prevent cache stampede and duplicate backend loads in a Go cache?

Prevent cache stampede in a Go cache by using WithLoaders for read-through caching with built-in singleflight deduplication, which collapses concurrent misses for the same key into a single backend fetch.

What's the best way to handle stale data and TTL expiration in Go in-memory caching?

Handle stale data and TTL expiration in Go in-memory caching by configuring TTL with optional jitter, enabling background janitor cleanup via WithJanitor, and applying stale-while-revalidate patterns using WithRevalidation.

When do I need sharding and Copy-on-Read/Write for Go in-memory caching?

Apply sharding to Go in-memory caching to reduce lock contention under high concurrency, and use Copy-on-Read/Write when cached values are mutable pointers, slices, or maps to prevent race conditions and ensure data correctness.

How do I monitor Go in-memory cache hit rates and capacity for production?

Monitor Go in-memory cache hit rates and capacity by enabling Prometheus metrics and sizing caches using working-set and memory budget guidance to support production-grade capacity planning.

Can I batch-fetch missing keys with a loader in a samber/hot Go cache?

Batch-fetch missing keys in a Go cache using WithLoaders to implement read-through caching that safely handles cache misses and deduplicates concurrent requests with singleflight.