CacheManager<T>.cacheOrSync constructor

CacheManager<T>.cacheOrSync({
  1. required SerializerFunc serializerFunc,
  2. required String key,
  3. required AsyncFunc<T> asyncBloc,
  4. int? ttlValue,
})

Implementation

CacheManager.cacheOrSync(
    {required SerializerFunc serializerFunc,
    required String key,
    required AsyncFunc<T> asyncBloc,
    int? ttlValue}) {
  _strategyBuilder = StrategyBuilder<T>(key, sotrageImplimentation)
      .withSerializer((serializerFunc))
      .withAsync(asyncBloc)
      .withStrategy(CacheOrAsyncStrategy());
  if (ttlValue != null) {
    _strategyBuilder.withTtl(ttlValue);
  }
}