put method

  1. @override
Future<void> put({
  1. required String key,
  2. required Uint8List bytes,
  3. Duration maxAge = const Duration(days: 30),
})
override

Adds the specified data to the cache under the specified key.

Implementation

@override
Future<void> put(
    {required String key,
    required Uint8List bytes,
    Duration maxAge = const Duration(days: 30)}) async {
  final timestamp = DateTime.now().millisecondsSinceEpoch;
  CacheDetails cacheDetails =
      CacheDetails(timestamp: timestamp, maxAge: maxAge.inMilliseconds, content: base64.encode(bytes));
  _internalCache.putIfAbsent(key, () => cacheDetails);
}