get method

Future<T?> get(
  1. String key
)

Get cached data (checks memory first, then disk)

Implementation

Future<T?> get(String key) async {
  // Check memory cache first
  final memCached = memoryCache.get(key);
  if (memCached != null) {
    return memCached.data;
  }

  // Check disk cache
  if (diskCache != null) {
    final diskCached = await diskCache!.get(key);
    if (diskCached != null) {
      // Promote to memory cache
      memoryCache.set(key, diskCached.data);
      return diskCached.data;
    }
  }

  return null;
}