exists abstract method

bool exists(
  1. Key key
)

Determines whether an entry associated with the given key exists.

This operation is commonly used by caching subsystems, rate-limit controllers, or configuration resolvers to avoid unnecessary retrievals. Implementations should ensure this check is efficient and free of side effects.

Parameters

  • key: The identifier representing the stored entry.

Returns

  • true if the key exists in the underlying store.
  • false if the key is not present.

Example

if (tokens.exists('session:abc')) {
  print('Session token found.');
}

Implementation

bool exists(Key key);