CachePutEvent class final
Event published when a value is stored in a cache.
This event indicates that a cache put operation has successfully stored a value in the specified cache. Observers can use this event to track cache writes, monitor TTL usage, or trigger logging and metrics collection.
Core Properties
source: The key associated with the cached value.- cacheName: The name of the cache where the value was stored.
- value: The object that was cached.
- ttl: Optional time-to-live duration applied to the cached entry.
timestamp: Optional timestamp of when the event occurred.
Usage Example
void onCachePut(CachePutEvent event) {
print('Stored value for key ${event.source} in cache ${event.cacheName} with TTL ${event.ttl}');
}
Observers can use this information to:
- Track cache write operations and patterns.
- Monitor TTL usage for cache entries.
- Collect metrics or trigger actions based on cached values.
- Inheritance
-
- Object
- CacheEvent
- CachePutEvent
Constructors
Properties
- cacheName → String
-
The name of the cache where this event occurred.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- ttl → Duration?
-
The TTL (time-to-live) applied to this cached entry, if any.
final
- value → Object?
-
The value that was stored in the cache.
final
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
getSource(
) → Object -
Returns the source of the event.
inherited
-
getTimestamp(
) → DateTime -
Returns the timestamp of the event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
toStringOptions(
) → ToStringOptions -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited