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