get method
Retrieves a cache entry by its key.
Returns null if:
- The key doesn't exist
- The entry has expired (implementations should auto-delete expired entries)
Implementations should check CacheEntry.isExpired and automatically delete expired entries before returning null.
Implementation
@override
CacheEntry? get(String key) {
final entry = _cache[key];
if (entry == null) return null;
// Check expiration
if (entry.isExpired) {
delete(key);
return null;
}
// Update LRU tracking
_accessOrder
..remove(key)
..addLast(key);
return entry;
}