A fast, concurrent, evicting in-memory cache for Go designed to store gigabytes of data with minimal GC overhead.
BigCache is an in-memory caching library for Go designed to store and manage gigabytes of data efficiently. It solves the problem of garbage collection pauses in large-scale caches by using a pointer-less map and byte slices, allowing high-speed concurrent access without performance degradation as the cache grows.
Go developers building high-performance applications that require fast, scalable caching for large datasets, such as web services, APIs, or data-intensive microservices.
Developers choose BigCache for its exceptional performance under heavy loads, minimal GC impact, and flexibility in configuration. It outperforms alternatives like freecache in many benchmarks and doesn't require predefining cache size, making it easier to integrate into dynamic environments.
Efficient cache for gigabytes of data written in Go.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a pointer-less map and byte slices to avoid garbage collection, as shown in benchmarks where GC pauses are up to 5x lower than standard maps with 20 million entries.
Employs configurable sharding to reduce lock contention, with benchmark results showing faster parallel reads and writes compared to freecache and concurrent maps.
Supports time-based eviction via LifeWindow and configurable CleanWindow intervals, allowing fine-tuned cache management without predefined size limits.
Does not require a fixed cache size upfront; can allocate additional memory when full, with an optional HardMaxCacheSize to prevent unbounded growth.
Stores entries as byte slices, requiring manual serialization and deserialization in most use cases, which adds complexity and potential performance costs.
Hash collisions result in silent data overwrites without warning, posing a risk for data integrity in high-load or hash-conflict scenarios.
Cleanup operations have a one-second minimum resolution, making sub-second precision impossible for eviction management, as noted in the config documentation.
Requires careful tuning of parameters like Shards and MaxEntriesInWindow for optimal performance, which can be error-prone without deep workload understanding.