putManyWithDuration method
Inserts many items into the cache with the given duration
Implementation
void putManyWithDuration(
List<T> items, String Function(T item) getKey, Duration duration) {
// Initialize the cache if needed
_cache ??= [];
final endTime = _nowInSeconds() + duration.inSeconds;
for (final item in items) {
final key = getKey(item);
final CacheItem<T> cacheItem = CacheItem<T>(key, item, endTime);
_cache!.add(cacheItem);
}
// Try to start the timer if not done yet
_tryStartTimer();
}