golang-samber-hot

Implement an in-memory Go cache with configurable eviction algorithms and TTL management.

Updated May 4, 2026
One-click install
npx skills add https://github.com/VIethoangnguyenle/nexus-enterprise --skill golang-samber-hot-viethoangnguyenle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-hot
Source: https://github.com/VIethoangnguyenle/nexus-enterprise/tree/main/.agent/skills/golang-samber-hot
Command: npx skills add https://github.com/VIethoangnguyenle/nexus-enterprise --skill golang-samber-hot-viethoangnguyenle

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a versatile and high-performance in-memory cache solution for Go applications, reducing latency and backend load in data-heavy systems.

Core Features & Use Cases

  • In-memory caching with multiple eviction algorithms: Supports LRU, LFU, TinyLFU, W-TinyLFU, ARC, S3FIFO, TwoQueue, SIEVE, and FIFO to optimize cache hit rates based on access patterns.
  • TTL, stale-while-revalidate, and loader integration: Enables timed expiry and background cache refreshing to maintain fresh data without blocking.
  • Use Case: Ideal for API response caching, session management, and reducing database load in microservices or web APIs.

Quick Start

Instantiate a cache with W-TinyLFU algorithm, set a TTL of 10 minutes, and enable janitor cleanup.

Frequently Asked Questions about golang-samber-hot

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

FAQPage Schema
How do I implement an in-memory cache in Go to reduce database load?

To implement an in-memory cache in Go, instantiate this Skill with a chosen eviction algorithm, set a TTL for timed expiry, and enable the background janitor cleanup. This reduces backend load by serving frequent data requests directly from memory.

What is the best eviction algorithm for high hit rates in a Golang cache?

The best eviction algorithm depends on your access patterns. This Skill supports multiple algorithms including W-TinyLFU, LRU, LFU, ARC, and S3FIFO, allowing you to optimize Golang cache hit rates based on whether your workload is scan-heavy or skewed.

Can I use a loader function with stale-while-revalidate for Go API caching?

Yes, you can integrate a loader function with stale-while-revalidate for Go API caching. This mechanism enables background cache refreshing to maintain fresh data without blocking the main request, ensuring low latency for API responses.

Does this Go cache support TTL with background expiration?

Yes, this Go cache supports TTL with background expiration. It includes a janitor cleanup feature that automatically removes expired entries in the background, ensuring your in-memory cache does not retain stale data or consume unnecessary memory.

When should I use W-TinyLFU over standard LRU in a Golang application?

Use W-TinyLFU over standard LRU in a Golang application when dealing with bursty or skewed access patterns. W-TinyLFU provides better cache hit rates by adapting to recent frequency while resisting cache pollution from one-time scans.