TCacheItem<T> class

A generic cache item class used for caching data with a time-to-live (TTL).

This class stores a value of type T and manages its expiry based on the provided TTL. It automatically calculates expiry time upon creation and provides methods to check expiry and update access time.

Constructors

TCacheItem.new(T value, Duration ttl)
Creates a new cache item with the given value and ttl.

Properties

hashCode int
The hash code for this object.
no setterinherited
isExpired bool
Checks if the cache item has expired.
no setter
lastAccessTime DateTime
The time when the item was last accessed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl Duration
The duration after which the cache item should expire.
final
value ↔ T
The value of the cache item.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateAccessTime() → void
Updates the lastAccessTime to the current time.

Operators

operator ==(Object other) bool
The equality operator.
inherited