Skip to main content

Crate content_cas

Crate content_cas 

Source
Expand description

§content-cas

Content-addressed cache. Store bytes under their SHA-256 hex, retrieve by hex. On-disk layout is root/aa/bbbb... (first 2 hex chars become a subdirectory to keep filesystem ls fast even at millions of keys).

Reasonable for embeddings, model responses, tokenizer outputs — any large, immutable, deterministic blob whose key is its content.

§Example

use content_cas::Cas;
let cas = Cas::new("/tmp/my-cas").unwrap();
let hash = cas.put(b"hello world").unwrap();
assert_eq!(hash.len(), 64);
let bytes = cas.get(&hash).unwrap().unwrap();
assert_eq!(bytes, b"hello world");

Structs§

Cas
On-disk content-addressed cache.