Expand description
Caching module for eure.
This module provides caching infrastructure with support for multiple cache types.
§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 the platform-specific cache directory (via directories crate):
- macOS:
~/Library/Caches/dev.eure.eure/ - Linux:
~/.cache/eure/ - Windows:
C:\Users\<User>\AppData\Local\eure\eure\cache\
Override with $EURE_CACHE_DIR environment variable.
Cache types are stored in subdirectories:
~/Library/Caches/dev.eure.eure/ # base_cache_dir() (macOS example)
https/ # https_cache_dir() - HTTPS fetched content
eure.dev/
a1/
b2/
a1b2c3d4-schema.eure # content
a1b2c3d4-schema.eure.meta # metadata (JSON)
# (future: compile/, build/, etc.)§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.