Crates.io | region_cached |
lib.rs | region_cached |
version | 0.1.36 |
created_at | 2025-03-08 06:05:21.845093+00 |
updated_at | 2025-08-22 09:27:36.967832+00 |
description | Adds a logical layer of caching between processor L3 cache and main memory |
homepage | |
repository | https://github.com/folo-rs/folo |
max_upload_size | |
id | 1584121 |
size | 115,533 |
On many-processor systems with multiple memory regions, there is an extra cost associated with accessing data in physical memory modules that are in a different memory region than the current processor:
This crate provides the capability to cache frequently accessed shared data sets in the local memory region, speeding up reads when the data is not already in the local processor caches. You can think of it as an extra level of caching between L3 processor caches and main memory.
// `RegionCachedExt` provides required extension methods on region-cached
// static variables, such as `with_cached()` and `set_global()`.
use region_cached::{RegionCachedExt, region_cached};
region_cached!(static FAVORITE_COLOR: String = "blue".to_string());
FAVORITE_COLOR.with_cached(|color| {
println!("My favorite color is {color}");
});
FAVORITE_COLOR.set_global("red".to_string());
More details in the package documentation.
This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.