Crate grafos_cache

Crate grafos_cache 

Source
Expand description

Elastic sharded maps and TTL-driven object caches for grafOS.

This crate provides two cache building blocks:

§Quick start

use grafos_cache::elastic::ElasticShardSet;
use grafos_cache::ttl::{TtlObjectCache, CacheStats};
use grafos_leasekit::RenewalPolicy;

// Elastic shard set
let mut shards: ElasticShardSet<u32, u32> =
    ElasticShardSet::new(2, 64, 8, 8)?;
shards.put(&1, &100)?;
assert_eq!(shards.get(&1)?, Some(100));

// TTL object cache
let mut cache = TtlObjectCache::<String>::new(RenewalPolicy::default());

§Feature flags

FeatureDefaultEffect
stdYesEnables std in grafos-std (thread-local mock state)
observeNoOptional grafos-observe integration

Modules§

elastic
Elastic sharded hash map backed by fabric memory.
ttl
TTL-driven object cache with poll-based expiry pruning.