Expand description
Shared utilities for cachelito procedural macros
This crate provides common parsing and code generation utilities
used by both cachelito-macros and cachelito-async-macros.
Structs§
- Async
Cache Attributes - Parsed macro attributes for async caching
- Async
Cache Attributes Builder - Builder for AsyncCacheAttributes following the Builder pattern
- Common
Attributes - Helper struct to group common attributes and avoid excessive function parameters
- Sync
Cache Attributes - Parsed macro attributes for sync caching
- Sync
Cache Attributes Builder - Builder for SyncCacheAttributes following the Builder pattern
Functions§
- generate_
key_ expr - Generate cache key expression based on function arguments (for async macros using format!)
- generate_
key_ expr_ with_ cacheable_ key - Generate cache key expression using CacheableKey trait (for sync macros)
- parse_
async_ attributes - Parse async cache attributes from a token stream
- parse_
cache_ if_ attribute - Parse the
cache_ifattribute Expects a function path likecache_if = should_cacheorcache_if = my_module::should_cache - parse_
decay_ interval_ attribute - Parse the
decay_intervalattribute - parse_
frequency_ weight_ attribute - Parse the
frequency_weightattribute - parse_
invalidate_ on_ attribute - Parse the
invalidate_onattribute Expects a function path likeinvalidate_on = is_staleorinvalidate_on = my_module::is_stale - parse_
limit_ attribute - Parse the
limitattribute - parse_
max_ memory_ attribute - Parse the
max_memoryattribute Supports formats like: “100MB”, “1GB”, “500KB”, or raw numbers - parse_
name_ attribute - Parse the
nameattribute - parse_
policy_ attribute - Parse the
policyattribute and return the string value - parse_
scope_ attribute - Parse the
scopeattribute and return the string value - parse_
sketch_ depth_ attribute - Parse the
sketch_depthattribute - parse_
sketch_ width_ attribute - Parse the
sketch_widthattribute - parse_
string_ array_ attribute - Parse array of strings from attribute (for tags, events, dependencies)
- parse_
sync_ attributes - Parse sync cache attributes from a token stream
- parse_
ttl_ attribute - Parse the
ttlattribute - parse_
window_ ratio_ attribute - Parse the
window_ratioattribute Expects a float value between 0.0 and 1.0 - policies_
str_ with_ separator