bcache alternatives and similar packages
Based on the "Database" category.
Alternatively, view bcache alternatives based on common mentions on social networks and blogs.
-
cockroach
CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. -
Milvus
Milvus is a high-performance, cloud-native vector database built for scalable vector ANN search -
tidb
TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications. -
groupcache
groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases. -
TinyGo
Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM. -
bytebase
World's most advanced database DevSecOps solution for Developer, Security, DBA and Platform Engineering teams. The GitHub/GitLab for database DevSecOps. -
immudb
immudb - immutable database based on zero trust, SQL/Key-Value/Document model, tamperproof, data change history -
go-cache
An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications. -
buntdb
BuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support -
pREST
PostgreSQL ➕ REST, low-code, simplify and accelerate development, ⚡ instant, realtime, high-performance on any Postgres application, existing or new -
xo
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server -
nutsdb
A simple, fast, embeddable, persistent key/value store written in pure Go. It supports fully serializable transactions and many data structures such as list, set, sorted set. -
lotusdb
Most advanced key-value database written in Go, extremely fast, compatible with LSM tree and B+ tree. -
gocraft/dbr (database records)
Additions to Go's database/sql for super fast performance and convenience.
SaaSHub - Software Alternatives and Reviews
Do you think we are missing an alternative of bcache or a related project?
Popular Comparisons
README
bcache
A Go Library to create distributed in-memory cache inside your app.
Features
- LRU cache with configurable maximum keys
- Eventual Consistency synchronization between peers
- Data are replicated to all nodes
- cache filling mechanism. When the cache of the given key is not exist, bcache coordinates cache fills such that only one call populates the cache to avoid thundering herd or cache stampede
Why using it
- if extra network hops needed by external caches like
redis
ormemcached
is not acceptable for you - you only need cache with simple
Set
,Get
, andDelete
operation - you have enough RAM to hold the cache data
How it Works
- Nodes find each other using Gossip Protocol
Only need to specify one or few nodes as bootstrap nodes, and all nodes will find each other using gossip protocol
- When there is cache
Set
andDelete
, the event will be propagated to all of the nodes.
So, all of the nodes will eventually have synced data.
Cache filling
Cache filling mechanism is provided in GetWithFiller func.
When the cache for the given key is not exists:
- it will call the provided
Filler
- set the cache using value returned by the
Filler
Even there are many goroutines which call GetWithFiller
, the given Filler
func
will only called once for each of the key.
Cache stampede could be avoided this way.
Quick Start
In server 1
bc, err := New(Config{
// PeerID: 1, // leave it, will be set automatically based on mac addr
ListenAddr: "192.168.0.1:12345",
Peers: nil, // it nil because we will use this node as bootstrap node
MaxKeys: 1000,
Logger: logrus.New(),
})
if err != nil {
log.Fatalf("failed to create cache: %v", err)
}
bc.Set("my_key", "my_val",86400)
In server 2
bc, err := New(Config{
// PeerID: 2, // leave it, will be set automatically based on mac addr
ListenAddr: "192.168.0.2:12345",
Peers: []string{"192.168.0.1:12345"},
MaxKeys: 1000,
Logger: logrus.New(),
})
if err != nil {
log.Fatalf("failed to create cache: %v", err)
}
bc.Set("my_key2", "my_val2", 86400)
In server 3
bc, err := New(Config{
// PeerID: 3,// will be set automatically based on mac addr
ListenAddr: "192.168.0.3:12345",
Peers: []string{"192.168.0.1:12345"},
MaxKeys: 1000,
Logger: logrus.New(),
})
if err != nil {
log.Fatalf("failed to create cache: %v", err)
}
val, exists := bc.Get("my_key2")
GetWithFiller example
c, err := New(Config{
PeerID: 3,
ListenAddr: "192.168.0.3:12345",
Peers: []string{"192.168.0.1:12345"},
MaxKeys: 1000,
})
if err != nil {
log.Fatalf("failed to create cache: %v", err)
}
val, exp,err := bc.GetWithFiller("my_key2",func(key string) (string, error) {
// get value from database
.....
//
return value, 0, nil
}, 86400)
Credits
- weaveworks/mesh for the gossip library
- groupcache for the inspiration