Carry cache age across a local storage interval
Starting freshness at zero on every cache hop can keep stale content alive. Carry the stored age forward before applying grace. An entry stored at age eight reaches age thirteen after five more ticks. Three ticks of its stale-serving grace remain.
Run the framework with your own input
Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-sanderling.git
cd blyx-sanderling
blyxc native-run project.blyx -- 8 100 105 10 6 0API and return values
Returns [mode, current age, ticks until mode changes]. Mode 0 serves fresh, 1 serves under explicit stale grace, and 2 requires validation. The host parses and enforces other cache directives. Invalid input returns an empty vector.
| Argument | Accepted input |
|---|---|
| age_at_store | nonnegative finite number |
| stored | nonnegative finite number |
| now | nonnegative finite number |
| lifetime | nonnegative finite number |
| grace | nonnegative finite number |
| mandatory | nonnegative exact integer |
Use the libraries independently
The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.
Try the program
Expected output
1 13 3
Practice
Change mandatory = 1.0. Predict the result, then run the program.
Hint
Returns [mode, current age, ticks until mode changes]. Mode 0 serves fresh, 1 serves under explicit stale grace, and 2 requires validation. The host parses and enforces other cache directives.
Worked solution
The result vector is [2, 13, 0]. Compare its fields with the return layout in the API section.
Find
let mandatory = 0.0;Replace with
let mandatory = 1.0;Output after the change
2 13 0
