| Crates.io | reactive-macros |
| lib.rs | reactive-macros |
| version | 0.4.1 |
| created_at | 2025-08-17 10:33:22.688713+00 |
| updated_at | 2025-12-26 02:31:48.511963+00 |
| description | A lightweight, dependency-aware memoization library with automatic invalidation and lazy recomputation. |
| homepage | |
| repository | https://github.com/fxdmhtt/ReactiveCache |
| max_upload_size | |
| id | 1799299 |
| size | 49,768 |
Cache smart, update only when it matters.
A lightweight, dependency-aware memoization library with automatic invalidation and lazy recomputation.
ReactiveCache automatically tracks the relationships between computed values and their data sources.
When a dependency becomes invalid, all cached results that rely on it are automatically invalidated.
The next time you access a cached value, it will be recomputed lazily and stored again.
ReactiveCache is structured around a clear three-tier reactive model:
Signal(s) → Memo(s) → Effect
Signal (atomic mutable) | +--> Memo (derived computation, cached value, lazy) | +--> Effect (side-effectful computation, eager)
Signal
Signals are the source of truth in the system. They hold raw values that can change over time.
Updating a signal automatically marks any dependent computations as potentially stale.
Memo
Memos are derived, computed values that depend on one or more signals (or other memos).
When a signal changes, all memos that depend on it are invalidated.
Accessing a memo after invalidation triggers lazy recomputation, ensuring that cached values are always consistent.
Effect
Effects are side-effectful computations that run automatically whenever their dependencies change.
They subscribe to signals and memos, reacting to updates without manual intervention.
Effects do not produce cached values; instead, they propagate changes outward (e.g., updating UI, logging, or triggering external events).
Dependency Flow:
This separation ensures efficient and predictable propagation: cached computations are only recomputed when needed, while side effects happen immediately when dependencies change.
This three-level model ensures that changes propagate efficiently, only recomputing what is necessary, and automatically triggering side-effects in a controlled and predictable way.