read method

T read (String key)
override

Get the content associated with the given key

Implementation

T read(String key) {
  if (!_store.containsKey(key)) {
    throw cacheMiss;
  }

  final CacheItem item = _store[key];

  final now = new DateTime.now();

  if (item.expiry is DateTime && now.isAfter(item.expiry)) {
    throw cacheMiss;
  }

  return item.value;
}