golang-samber-hot

Implement in-memory caching for Golang applications using samber/hot.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-samber-hot-luigiapcpereira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-hot
Source: https://github.com/LuigiAPCPereira/evolutiondocs/tree/main/.agents/skills/golang-samber-hot
Command: npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-samber-hot-luigiapcpereira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/samber/hot, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of efficient in-memory caching for Golang applications, leveraging the samber/hot library for optimal performance and memory usage.

Core Features & Use Cases

  • In-Memory Caching: Provides a type-safe caching solution with 9 eviction algorithms.
  • Eviction Algorithms: Supports LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO algorithms.
  • TTL and Loaders: Offers TTL and loader chains for efficient data retrieval and expiration.
  • Use Case: Ideal for projects that frequently load medium-to-low cardinality resources and need to reduce latency.

Quick Start

Add the samber/hot cache to your project by executing 'go get -u github.com/samber/hot' and configure it in your code.

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 in-memory caching in Golang to reduce latency for frequently loaded resources?

In-memory caching in Golang is implemented using the samber/hot library, which provides type-safe caching with 9 eviction algorithms. It targets scenarios needing fast access to frequently requested medium-to-low cardinality resources to reduce latency.

What eviction algorithms are available for Golang memory optimization with samber/hot?

Golang memory optimization with samber/hot supports 9 eviction algorithms: LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, and FIFO. These algorithms manage cache entries to optimize memory usage and access performance.

Does samber/hot work with Go 1.22 and support TTL for cached data?

Yes, samber/hot is compatible with Go 1.22+ and supports TTL for data expiration. It also offers loader chains for efficient data retrieval, ensuring cached data is automatically refreshed when its time-to-live expires.

What is the best way to add samber/hot to a Golang project for type-safe caching?

The best way to add samber/hot for type-safe caching is by executing 'go get -u github.com/samber/hot' in your project directory, then configuring the cache instance and its eviction algorithm directly in your application code.

When should I use in-memory caching instead of relying on direct database access in Golang?

In-memory caching should be used in Golang when your project frequently loads medium-to-low cardinality resources and needs to reduce latency. It prevents repetitive expensive database queries by storing frequently accessed data in memory.

Why does my Golang application need loader chains for in-memory caching?

Golang applications need loader chains for in-memory caching to efficiently retrieve data on cache misses. Loaders automatically fetch missing data from the source, populate the cache, and reduce manual data fetching logic in your code.