put<T> method

Future<void> put<T>(
  1. String key,
  2. T value, {
  3. int? seconds,
})

Stores a value in the cache.

Implementation

Future<void> put<T>(String key, T value, {int? seconds}) async {
  DateTime? expiration;
  if (seconds != null) {
    expiration = NyTime.now().add(Duration(seconds: seconds));
  }
  _store[key] = _CacheEntry(value: value, expiration: expiration);
}