PermissionCache class
TTL-aware cache for PermissionDecisions.
Stores decisions keyed by the request's cache key. Entries are automatically considered stale after their TTL or PermissionDecision.autoExpiry.
Constructors
- PermissionCache({Duration defaultTtl = const Duration(minutes: 30)})
Properties
- defaultTtl → Duration
-
Default time-to-live for cached decisions.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the cache is empty.
no setter
-
keys
→ List<
String> -
Get all cache keys (for debugging).
no setter
- length → int
-
Number of entries currently in the cache.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearAll(
) → void - Clear all cached entries.
-
get(
String key) → PermissionDecision? - Get a cached decision by key. Returns null if not found or expired.
-
invalidate(
String key) → bool - Remove a specific entry by key. Returns true if it existed.
-
invalidateScope(
PermissionScope scope) → int - Remove all entries matching a scope.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
purgeExpired(
) → int - Remove all expired entries.
-
set(
String key, PermissionDecision decision, {Duration? ttl}) → void - Store a decision in the cache with optional custom TTL.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited