put method

  1. @override
Future<void> put(
  1. String key,
  2. dynamic value, {
  3. Duration? ttl,
})
override

Stores an item in the cache for a given duration.

Implementation

@override
Future<void> put(String key, dynamic value, {Duration? ttl}) async {
  final expiresAt = ttl != null ? DateTime.now().add(ttl) : null;
  _storage[key] = _CacheEntry(value, expiresAt);
}