A flexible multi-layer Go caching library implementing Cache-Aside pattern for in-memory and shared caches like Redis.
go-cache is a Go library that provides a flexible multi-layered caching solution, coordinating between private in-memory caches and shared caches like Redis. It implements the Cache-Aside pattern to automatically load data from sources (e.g., databases) on cache misses, improving application performance and scalability in distributed systems.
Go developers building high-performance applications that require efficient caching strategies, especially those working with distributed systems and needing consistency between local and shared caches.
Developers choose go-cache for its unified interface that simplifies multi-layer cache management, built-in consistency mechanisms via Pub-Sub, and concurrency safety, reducing the complexity of implementing robust caching in Go applications.
A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a single interface to coordinate between local and shared caches, simplifying cache management with methods like Cache.Get() and Set(), as shown in the basic usage examples.
Uses Pub-Sub pattern to evict keys across distributed instances, ensuring private caches remain consistent, detailed in the eviction sequence diagram in the README.
Implements built-in mechanisms to prevent data races on single instances, enhancing reliability in high-concurrency environments, as mentioned in the features list.
Allows pluggable marshal/unmarshal functions for data compression and format control, exemplified with msgpack in the advanced usage examples.
Primarily designed around Redis for shared caching, with the NewRedis adapter as the default, limiting flexibility for other backends without custom adapters.
Requires initializing a Factory and defining settings for each cache group, which can be more involved than simpler caching libraries like sync.Map or basic key-value stores.
The multi-layer coordination and Pub-Sub consistency mechanisms may introduce latency compared to direct cache access, especially in high-throughput or latency-sensitive applications.