get method

dynamic get(
  1. String key
)

Retrieves a value from the cache.

Returns the cached value if found and not expired, null otherwise.

Implementation

dynamic get(String key) {
  final entry = _cache[key];
  if (entry == null) return null;

  if (entry.isExpired) {
    _cache.remove(key);
    return null;
  }

  // Update access time for LRU
  entry.updateAccessTime();
  return entry.value;
}