CI / Rustfmt (push) Canceled after 0s
CI / Clippy (push) Canceled after 0s
CI / Test (workspace all features) (push) Canceled after 0s
CI / Test (workspace default features) (push) Canceled after 0s
CI / Test (mytheclipse / bg only) (push) Canceled after 0s
CI / Test (mytheclipse / compute only) (push) Canceled after 0s
CI / Test (mytheclipse / io only) (push) Canceled after 0s
CI / Test (mytheclipse / lifecycle only) (push) Canceled after 0s
CI / Test (mytheclipse / observability only) (push) Canceled after 0s
CI / Test (mytheclipse / resiliency only) (push) Canceled after 0s
CI / Test (mytheclipse / traffic only) (push) Canceled after 0s
CI / Test (mytheclipse-cache / l2-redis) (push) Canceled after 0s
CI / Test (mytheclipse-cache / l1-moka) (push) Canceled after 0s
CI / Test (mytheclipse-cache / default) (push) Canceled after 0s
CI / Test (mytheclipse-config / default) (push) Canceled after 0s
CI / Test (mytheclipse-crypto / default) (push) Canceled after 0s
CI / Test (mytheclipse-event / amqp) (push) Canceled after 0s
CI / Test (mytheclipse-event / nats) (push) Canceled after 0s
CI / Test (mytheclipse-event / default (mem)) (push) Canceled after 0s
CI / Test (mytheclipse-storage / gcs) (push) Canceled after 0s
CI / Test (mytheclipse-storage / s3) (push) Canceled after 0s
CI / Test (mytheclipse-storage / default (local)) (push) Canceled after 0s
CI / Run mytheclipse example (push) Canceled after 0s
CI / Docs check (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-cache) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-config) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-crypto) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-event) (push) Canceled after 0s
CI / Cargo package dry-run (mytheclipse-storage) (push) Canceled after 0s
Release / Semantic Release (push) Canceled after 0s
Rename all `corex-cache`, `corex-storage`, `corex-event`, `corex-config`, and `corex-crypto` crates to `mytheclipse-cache`, `mytheclipse-storage`, `mytheclipse-event`, `mytheclipse-config`, and `mytheclipse-crypto` respectively, aligning with the `mytheclipse` root crate naming convention. - Convert root `Cargo.toml` from a package manifest to a workspace manifest with explicit member paths - Update crate names in each `Cargo.toml` and docs.rs URLs - Update all import paths, module doc comments, and error/panic messages from `corex-*` to `mytheclipse-*` across source and README files - Update CI workflow and publish script to reference the new crate names<tool_call></think>chore: rename corex-* crates to mytheclipse-* namespace Rename all `corex-cache`, `corex-storage`, `corex-event`, `corex-config`, and `corex-crypto` crates to `mytheclipse-cache`, `mytheclipse-storage`, `mytheclipse-event`, `mytheclipse-config`, and `mytheclipse-crypto` respectively, aligning with the `mytheclipse` root crate naming convention. - Convert root `Cargo.toml` from a package manifest to a workspace manifest with explicit member paths - Update crate names in each `Cargo.toml` and docs.rs URLs - Update all import paths, module doc comments, and error/panic messages from `corex-*` to `mytheclipse-*` across source and README files - Update CI workflow and publish script to reference the new crate names
34 lines
1.1 KiB
Markdown
34 lines
1.1 KiB
Markdown
# mytheclipse-cache
|
|
|
|
A unified multi-layer cache abstraction so your app isn't locked to one cache
|
|
provider. Combines an in-process **L1** cache with a distributed **L2** cache
|
|
(e.g. Redis/Valkey) behind one simple `get`/`set`/`invalidate` API, plus a
|
|
**cache-aside / auto-refresh** helper.
|
|
|
|
## Features
|
|
|
|
- `l1-memory` (default) — zero-dependency in-process cache.
|
|
- `l1-moka` — high-performance Moka-backed L1 with TTL/max-capacity.
|
|
- `l2-redis` — Redis/Valkey L2 via `fred`.
|
|
- `cache-aside` (default) — read-through cache-aside helper.
|
|
|
|
## Usage
|
|
|
|
```rust
|
|
use mytheclipse_cache::{Cache, MemoryCache, MultiLayerCache, CacheAside};
|
|
|
|
let cache = MultiLayerCache::new(
|
|
MemoryCache::new(), // L1
|
|
MemoryCache::new(), // L2 (use RedisCache in production)
|
|
);
|
|
cache.set("k", b"v".to_vec(), None).await.unwrap();
|
|
let v = cache.get("k").await.unwrap();
|
|
|
|
// Cache-aside: fill misses from a source of truth.
|
|
let aside = CacheAside::new(
|
|
MemoryCache::new(),
|
|
|key| async move { Some(format!("data-for-{key}").into_bytes()) },
|
|
);
|
|
let _ = aside.get("orders:42").await.unwrap();
|
|
```
|