src/meta/plugins/cache/README.md
A distributed cache implementation based on meta-service, providing reliable resource management and data synchronization across distributed systems.
See https://github.com/databendlabs/sub-cache/ for details about Usage, Internal types and Concurrency Control.
<prefix>/foo
<prefix>/..
<prefix>/..
<prefix>: User-defined string to identify a cache instancelet client = MetaGrpcClient::try_create(/*..*/);
let cache = Cache::new(
client,
"your/cache/key/space/in/meta/service",
"your-app-name-for-logging",
).await;
// Access cached data
cache.try_access(|c: &CacheData| {
println!("last-seq:{}", c.last_seq);
println!("all data: {:?}", c.data);
}).await?;
// Get a specific value
let value = cache.try_get("key").await?;
// List all entries under a prefix
let entries = cache.try_list_dir("prefix").await?;
Initialization completes when cache receives full data copy from meta-service, ensuring consistent view.
The cache implements robust error handling:
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.