CachedDataMap<T> constructor

CachedDataMap<T>({
  1. required ChannelType channelType,
  2. required String channelUrl,
  3. Map<String, T> data = const {},
  4. int? timestamp,
})

Implementation

CachedDataMap({
  required ChannelType channelType,
  required String channelUrl,
  Map<String, T> data = const {},
  int? timestamp,
})  : _channelType = channelType,
      _channelUrl = channelUrl {
  policy = PeriodEviction(periodInSeconds: 180, evict: evict);

  data.forEach((key, value) {
    final data = CachedData<T>(
      value: value,
      ts: timestamp ?? DateTime.now().millisecondsSinceEpoch,
    );
    _cachedDataMap[key] = data;
  });
}