DataCacheManager constructor

DataCacheManager({
  1. Config config = const Config(),
  2. DataStore? dataStore,
})

Create a new instance of DataCacheManager.

You can pass in your config to customize the DataCacheManager. You can also pass in your own dataStore implementation for storing the data.

Implementation

DataCacheManager({this.config = const Config(), DataStore? dataStore})
    : dataStore = dataStore ?? DataStoreSqflite(dbName: config.dbKey) {
  if (config.cleanupOnInit) {
    if (config.stalePeriod != null) removeStale();
    if (config.maxCacheSize != null) _removeOversized();
  } else if (config.cleanupInterval != null) {
    _scheduleCleanup();
  }
}