Crate cachelito_macro_utils

Crate cachelito_macro_utils 

Source
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§

AsyncCacheAttributes
Parsed macro attributes for async caching
AsyncCacheAttributesBuilder
Builder for AsyncCacheAttributes following the Builder pattern
CommonAttributes
Helper struct to group common attributes and avoid excessive function parameters
SyncCacheAttributes
Parsed macro attributes for sync caching
SyncCacheAttributesBuilder
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_if attribute Expects a function path like cache_if = should_cache or cache_if = my_module::should_cache
parse_decay_interval_attribute
Parse the decay_interval attribute
parse_frequency_weight_attribute
Parse the frequency_weight attribute
parse_invalidate_on_attribute
Parse the invalidate_on attribute Expects a function path like invalidate_on = is_stale or invalidate_on = my_module::is_stale
parse_limit_attribute
Parse the limit attribute
parse_max_memory_attribute
Parse the max_memory attribute Supports formats like: “100MB”, “1GB”, “500KB”, or raw numbers
parse_name_attribute
Parse the name attribute
parse_policy_attribute
Parse the policy attribute and return the string value
parse_scope_attribute
Parse the scope attribute and return the string value
parse_sketch_depth_attribute
Parse the sketch_depth attribute
parse_sketch_width_attribute
Parse the sketch_width attribute
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 ttl attribute
parse_window_ratio_attribute
Parse the window_ratio attribute Expects a float value between 0.0 and 1.0
policies_str_with_separator