has method
Checks if a key exists in the cache and has not expired.
Returns true if the key is present in the cache and its TTL has not expired,
otherwise returns false.
Throws an exception if the key is null or empty.
- Parameters:
key: A non-null, non-empty string representing the cache key.
- Returns:
trueif the key exists and is valid,falseotherwise.
Implementation
@override
Future<bool> has(String key) async {
return await get(key) != null;
}