get method

AIResponse? get(
  1. String key
)

Attempts to retrieve a cached response for the given key.

Returns null if not found or expired.

Implementation

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

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

  return entry.response;
}