Expand description
Remote schema caching module.
This module provides caching for remote schema files fetched over HTTP(S).
§Module Organization
- Core types (always available):
CacheMeta,CacheKeyInfo, path computation - Native I/O (requires
nativefeature):fetch,FsStorage,gc
§Cache Layout
The cache is stored in ~/.cache/eure/schemas/ (or $EURE_CACHE_DIR).
Files are organized with 2-level directory sharding to prevent overcrowding:
~/.cache/eure/schemas/
eure.dev/
a1/
b2/
a1b2c3d4-eure-schema.schema.eure # content
a1b2c3d4-eure-schema.schema.eure.meta # metadata (JSON)§Example (native only)
use url::Url;
use eure_env::cache::{fetch, CacheOptions};
let url = Url::parse("https://eure.dev/v0.1.0/schemas/eure-schema.schema.eure").unwrap();
let result = fetch(&url, &CacheOptions::default()).unwrap();
println!("Content: {}", result.content);
println!("From cache: {}", result.from_cache);Structs§
- Cache
KeyInfo - Information about a cache key derived from a URL.
- Cache
Meta - Metadata for a cached file.
- Conditional
Headers - Conditional GET headers.
Enums§
- Cache
Action - Result of checking cache freshness.
Functions§
- compute_
cache_ key - Compute cache key information from a URL.
- compute_
content_ hash - Compute SHA256 hash of content and return as hex string.
- lock_
path - Get the lock file path for a cache file.
- meta_
path - Get the meta file path for a cache file.
- url_
to_ cache_ path - Convert URL to full cache file path.