Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. bcache

bcache

MITGov0.2

A Go library for creating a distributed in-memory cache with eventual consistency and cache stampede prevention.

GitHubGitHub
163 stars20 forks0 contributors

What is bcache?

bcache is a Go library for creating a distributed in-memory cache that runs inside your application. It provides eventual consistency across nodes and prevents cache stampede by coordinating cache fills, making it ideal for low-latency caching needs without relying on external cache services.

Target Audience

Go developers building distributed applications that require fast, in-memory caching with synchronization across multiple instances, especially those who want to avoid the network overhead of external caches like Redis.

Value Proposition

Developers choose bcache for its simplicity, performance, and ability to eliminate extra network hops by embedding caching directly in the application, while providing robust features like cache stampede prevention and automatic node discovery.

Overview

Eventually consistent distributed in-memory cache Go library

Use Cases

Best For

  • Reducing latency by avoiding external cache network hops
  • Building distributed Go applications with synchronized in-memory caching
  • Preventing cache stampede in high-concurrency environments
  • Implementing eventual consistency across multiple service instances
  • Scenarios where RAM is sufficient to hold cache data
  • Applications needing simple Set, Get, and Delete cache operations

Not Ideal For

  • Applications requiring strong, immediate consistency across all cache nodes
  • Projects needing advanced caching features like persistence, data partitioning, or complex eviction policies
  • Environments with strict memory constraints where cache data size exceeds available RAM
  • Non-Go based systems or when a managed, external cache service is preferred for operational simplicity

Pros & Cons

Pros

Zero Network Overhead

By embedding the cache in the application, bcache eliminates the network latency associated with external caches like Redis, as highlighted in the 'Why using it' section for low-latency needs.

Built-in Stampede Protection

The GetWithFiller function ensures only one goroutine populates a missing key, preventing cache stampede, which is explicitly detailed in the 'Cache filling' section of the README.

Simple Distributed Setup

Nodes automatically discover each other via gossip protocol with minimal configuration of bootstrap nodes, making deployment easy, as explained in the 'How it Works' part.

Minimal Operational Overhead

As an in-memory library, it reduces the need for managing separate cache servers, aligning with its lightweight philosophy mentioned in the README's introduction.

Cons

Eventual Consistency Trade-offs

Synchronization via gossip protocol means data replication is not immediate, leading to potential stale reads, which might not suit applications needing strong consistency.

Limited Eviction and Features

Only supports LRU eviction and basic Set, Get, Delete operations; it lacks features like TTL per key with flexible policies or built-in persistence, as admitted in the README's focus on simplicity.

Memory Bound Scalability

Cache size is limited by each node's RAM, as cautioned in the 'Why using it' section, which can restrict use with large datasets or in memory-constrained environments.

Open Source Alternative To

bcache is an open-source alternative to the following products:

Redis
Redis

An open-source, in-memory data structure store used as a database, cache, and message broker. It supports various data structures such as strings, hashes, lists, sets, and more.

M
Memcached

Memcached is a high-performance, distributed memory object caching system that speeds up dynamic web applications by reducing database load through caching data in RAM.

Frequently Asked Questions

Quick Stats

Stars163
Forks20
Contributors0
Open Issues3
Last commit3 years ago
CreatedSince 2018

Tags

#in-memory-cache#lru-cache#distributed-cache#go-library#low-latency#golang#cache#crdt#eventual-consistency

Built With

G
Go

Included in

Go169.1k
Auto-fetched 22 hours ago

Related Projects

groupcachegroupcache

groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.

Stars13,334
Forks1,393
Last commit1 year ago
BigCacheBigCache

Efficient cache for gigabytes of data written in Go.

Stars8,138
Forks607
Last commit1 month ago
ristrettoristretto

A high performance memory-bound Go cache

Stars6,916
Forks438
Last commit1 month ago
gocachegocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches

Stars2,863
Forks222
Last commit28 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub