# coocood/freecache

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/coocood-freecache).**

5,399 stars · 406 forks · Go · MIT

## Links

- GitHub: https://github.com/coocood/freecache
- awesome-repositories: https://awesome-repositories.com/repository/coocood-freecache.md

## Description

freecache is a high-performance, concurrent in-memory key-value store library for Go applications. It functions as a fixed-size cache that manages large volumes of data while eliminating garbage collection overhead through the use of preallocated memory and off-heap storage.

The system maintains a predictable memory footprint by utilizing fixed memory allocation and circular buffer management, where new entries automatically overwrite the oldest data upon reaching capacity. It further reduces contention between simultaneous readers and writers through lock-striped concurrent access.

The library includes a server interface that implements a subset of the Redis protocol, allowing external clients to communicate with the cache using standard commands and pipelining. Data lifecycle is managed via time-to-live expiration and automated eviction policies.

## Tags

### Data & Databases

- [Go In-Memory Caches](https://awesome-repositories.com/f/data-databases/go-in-memory-caches.md) — Provides a high-performance in-memory key-value store for Go applications designed to eliminate garbage collection pauses.
- [Cache Eviction Policies](https://awesome-repositories.com/f/data-databases/cache-eviction-policies.md) — Utilizes cache eviction policies based on expiration timestamps and LRU algorithms to maintain memory limits. ([source](https://github.com/coocood/freecache#readme))
- [Concurrent Caches](https://awesome-repositories.com/f/data-databases/concurrent-write-optimizations/concurrent-caches.md) — Provides a thread-safe concurrent cache designed for high-concurrency environments with simultaneous reader and writer access.
- [Least Recently Used Caches](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/caching-performance/caching/least-recently-used-caches.md) — Implements a fixed-size cache that discards the oldest or least-recently-used entries when capacity limits are reached.
- [Redis Client Interfaces](https://awesome-repositories.com/f/data-databases/redis-client-interfaces.md) — Implements a Redis-compatible interface allowing external clients to communicate using standard Redis commands and pipelining. ([source](https://github.com/coocood/freecache/blob/master/README.md))
- [Redis Protocol Parsers](https://awesome-repositories.com/f/data-databases/redis-protocol-parsers.md) — Integrates a Redis protocol parser to allow external clients to communicate via standard Redis commands.
- [Protocol Servers](https://awesome-repositories.com/f/data-databases/redis-protocol-parsers/protocol-servers.md) — Implements a server interface that supports a subset of Redis commands and pipelining for external communication.

### Operating Systems & Systems Programming

- [Circular Memory Buffers](https://awesome-repositories.com/f/operating-systems-systems-programming/circular-memory-buffers.md) — Utilizes a circular memory buffer to automatically overwrite the oldest data when the fixed cache capacity is reached.
- [Off-Heap Memory Managers](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/custom-memory-allocators/off-heap-image-allocators/off-heap-memory-managers.md) — Allocates data outside the managed heap to eliminate garbage collection overhead and prevent runtime pauses.
- [Slab Allocators](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/slab-allocators.md) — Uses slab allocators with fixed-size chunks to minimize memory fragmentation and ensure a predictable footprint.

### Software Engineering & Architecture

- [Fixed Memory Buffers](https://awesome-repositories.com/f/software-engineering-architecture/memory-buffering/fixed-memory-buffers.md) — Constrains memory usage to a preallocated fixed size to prevent application crashes and manage data via eviction.
- [Memory-Limited Caches](https://awesome-repositories.com/f/software-engineering-architecture/memory-limited-caches.md) — Implements memory-limited caching by capping the total byte size through strictly limited preallocated memory. ([source](https://github.com/coocood/freecache/blob/master/README.md))
- [Lock-Striped Sharding](https://awesome-repositories.com/f/software-engineering-architecture/producer-consumer-workflow-managers/lock-free-concurrent-queues/locking-optimizations/lock-striped-sharding.md) — Employs lock-striped sharding to divide the data set and reduce contention among simultaneous readers and writers.
- [Concurrent Data Structures](https://awesome-repositories.com/f/software-engineering-architecture/thread-safe-logging/thread-safe-assertion-recording/thread-safe-registries/concurrent-data-structures.md) — Provides concurrent data structures that ensure thread-safe operations during simultaneous read and write access. ([source](https://github.com/coocood/freecache#readme))

### Part of an Awesome List

- [TTL Expiration Management](https://awesome-repositories.com/f/awesome-lists/data/caching-and-sessions/key-value-session-stores/cache-value-writers/cache-value-incrementers/ttl-expiration-management.md) — Provides TTL expiration management to automatically remove stale cache entries based on timestamps.
- [Caching Libraries](https://awesome-repositories.com/f/awesome-lists/data/caching-libraries.md) — Zero-GC cache library.

### Web Development

- [Time-To-Live Expirations](https://awesome-repositories.com/f/web-development/data-fetching-caching/cache-invalidation-utilities/time-to-live-expirations.md) — Implements time-to-live expirations to automatically remove stale cache entries and keep data current.
