get<T> method
Retrieves a value from the cache by its identifier.
key - Unique identifier of the value
Returns the stored value or null if it doesn't exist or has expired
Implementation
@override
Future<T?> get<T>(String key) async {
final entry = _cache[key];
if (entry == null) {
_misses++;
return null;
}
// Check if expired
if (entry.isExpired) {
await remove(key);
_misses++;
return null;
}
// Update access information
final now = DateTime.now();
entry.lastAccessedAt = now;
entry.accessCount++;
_updateAccessTracking(key, now);
_hits++;
return entry.value as T?;
}