plugins/plugins library

hihook plugins - reusable storage-agnostic hooks and conditions.

Plugins operate on ctx.data['meta'] which consumers must provide. See individual plugins for metadata requirements.

Classes

Base64Plugin
Base64 Plugin - Automatic encoding/decoding of payload values.
LruPlugin
LRU Plugin - Least Recently Used cache management.
TtlPlugin
TTL Plugin - Time-To-Live expiration management.

Properties

ttlNotExpired → HiCond
Default TTL condition instance.
final

Functions

base64DecodeHook({String uid = 'base64:decode', List<String> events = const ['read', 'get'], HiPhase phase = HiPhase.post, int priority = 0, bool urlSafe = false, bool asString = true}) → HiHook
Creates a Base64 decode hook for read operations.
base64EncodeHook({String uid = 'base64:encode', List<String> events = const ['write', 'put'], HiPhase phase = HiPhase.pre, int priority = 0, bool urlSafe = false}) → HiHook
Creates a Base64 encode hook for write operations.
base64EncodeIfFlaggedHook({String uid = 'base64:encodeIfFlagged', List<String> events = const ['write', 'put'], HiPhase phase = HiPhase.pre, int priority = 0, bool urlSafe = false, String flagKey = 'encode'}) → HiHook
Creates a conditional Base64 encode hook.
lruFrequentlyAccessedCondition({String name = 'lru:frequentlyAccessed', String metaKey = 'meta', String accessCountKey = 'access_count', required int minAccessCount}) → HiCond
Creates an LRU condition based on access count threshold.
lruInitHook({String uid = 'lru:init', List<String> events = const ['write', 'put'], String metaKey = 'meta', String lastAccessedKey = 'last_accessed', String accessCountKey = 'access_count', int nowProvider()?, HiPhase phase = HiPhase.post, int priority = 0}) → HiHook
Creates an LRU initialization hook for new entries.
lruRecentlyAccessedCondition({String name = 'lru:recentlyAccessed', String metaKey = 'meta', String lastAccessedKey = 'last_accessed', required int thresholdMs, int nowProvider()?}) → HiCond
Creates an LRU condition that checks if an entry was accessed recently.
lruTouchHook({String uid = 'lru:touch', List<String> events = const ['read', 'get'], String metaKey = 'meta', String lastAccessedKey = 'last_accessed', String accessCountKey = 'access_count', bool trackAccessCount = false, int nowProvider()?, HiPhase phase = HiPhase.post, int priority = 0}) → HiHook
Creates an LRU touch hook that updates access metadata on read.
ttlCleanupHook({String uid = 'ttl:cleanup', List<String> events = const ['read'], HiCond? condition, HiPhase phase = HiPhase.main, int priority = 0}) → HiHook
Creates a TTL cleanup hook that returns HiDelete for expired entries.
ttlNotExpiredCondition({String name = 'ttl:notExpired', String metaKey = 'meta', String createdAtKey = 'created_at', String ttlSecondsKey = 'ttl_seconds', int nowProvider()?}) → HiCond
Creates a TTL condition that checks if an entry is not expired.
ttlStampHook({String uid = 'ttl:stamp', List<String> events = const ['write', 'put'], String metaKey = 'meta', String createdAtKey = 'created_at', int nowProvider()?, HiPhase phase = HiPhase.post, int priority = 0}) → HiHook
Creates a TTL stamp hook that sets creation timestamp on write.