FFCache constructor

FFCache({
  1. String name = _default_name,
  2. Duration defaultTimeout = _defaultTimeoutDuration,
  3. bool debug = false,
})

Returns a FFCache object.

FFCache objects are created and managed internally. FFCache objects are created only once for each name.

Cache files are stored in temporary_directory/name (default: ffcache). Cache entries expires after defaultTimeout (default: 1 day). ffcache uses _ffcache.json to store internal information. If you try to use '_ffcache.json' as key, it will through an Exception.

Implementation

factory FFCache(
    {String name = _default_name,
    Duration defaultTimeout = _defaultTimeoutDuration,
    bool debug = false}) {
  final cache = _ffcaches[name];
  if (cache != null) {
    cache._debug = debug;
    cache._defaultTimeout = defaultTimeout;
    return cache;
  } else {
    final newCache = FFCache._(name, debug, defaultTimeout);
    _ffcaches[name] = newCache;
    return newCache;
  }
}