TCacheItem<T> constructor
TCacheItem<T> (
- T value,
- Duration ttl
Creates a new cache item with the given value
and ttl
.
Initializes the lastAccessTime to the current time and calculates
the _expiryTime
based on the ttl
.
Implementation
TCacheItem(this.value, this.ttl) {
lastAccessTime = DateTime.now();
_expiryTime = lastAccessTime.add(ttl);
}