get<T> abstract method

Future<T?> get<T>({
  1. required String key,
})

Retrieves a value from the cache by its key.

This method performs several checks:

  1. Existence: Checks if the file exists on the storage engine.
  2. Corruption: If the file is corrupt (invalid JSON), it deletes the file and returns null.
  3. Expiry: If the item has passed its expiryTime, it deletes the file and returns null.

Side Effect: If the item is valid, this triggers EvictionManager.updateUsage, moving the item to the front of the queue (if using LRU strategy).

Implementation

Future<T?> get<T>({required String key});