get method
Retrieves an item from the cache.
Returns the item's value if it exists and has not expired. Otherwise,
removes the expired item (if it exists) and returns null.
Implementation
T? get(String? key) {
if (key == null) return null;
final item = _cache[key];
if (item == null) return null;
if (item.isExpired) {
_evict(key);
return null;
}
return item.value;
}