golang-samber-hot

Guide building in-memory Go caches with samber/hot eviction strategies.

7|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/Harmeet10000/skills --skill golang-samber-hot-harmeet10000
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-hot
Source: https://github.com/Harmeet10000/skills/tree/main/skills/backend/Golang/golang-samber-hot
Command: npx skills add https://github.com/Harmeet10000/skills --skill golang-samber-hot-harmeet10000

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provide guidance for implementing an in-memory caching layer in Go using samber/hot to optimize latency and reduce backend load across diverse workloads.

Core Features & Use Cases

  • Nine eviction algorithms exposed via simple constants (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO) to fit different access patterns.
  • TTL support, loader chains with singleflight deduplication, and optional stale-while-revalidate, enabling robust freshness guarantees.
  • Sharding, copy-on-read/copy-on-write, and Prometheus metrics for high-concurrency production deployments and observability.

Quick Start

Create a Hot cache using hot.WTinyLFU with a capacity of 10,000 and a 5-minute TTL, then build and start using it in your Go service.

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 cache eviction strategy for my workload?

Choosing a Go cache eviction strategy depends on your access patterns. This Skill guides you through selecting from nine algorithms like LRU, LFU, W-TinyLFU, and SIEVE to optimize latency and reduce backend load for diverse workloads.

What is the best way to implement an in-memory Go cache with TTL and loaders?

The best way to implement an in-memory Go cache is using samber/hot. This Skill provides steps to configure TTL management, loader chains with singleflight deduplication, and stale-while-revalidate for robust data freshness.

Does samber/hot support high-concurrency caching with Prometheus metrics?

Yes, samber/hot supports high-concurrency caching deployments. This Skill illustrates how to enable sharding, copy-on-read or copy-on-write, and integrate Prometheus metrics for production-grade observability.

Can I warm up a Go cache before starting my service?

Yes, you can warm up a Go cache before serving traffic. This Skill covers how to initialize and warm up your samber/hot cache instance with safe defaults, ensuring optimal hit rates immediately upon service startup.

How do cache algorithms like TinyLFU and ARC differ for Go applications?

Cache algorithms like TinyLFU and ARC differ in how they track and evict entries to fit specific access patterns. This Skill explains these distinctions to help you select the best eviction algorithm for your Go application.

When should I not use an in-memory Go cache?

You should not use an in-memory Go cache when your dataset exceeds available RAM or requires persistence across restarts. This Skill helps evaluate limitations and configure safe defaults for production-grade caching layers.