hurshi / dio-http-cache

http cache lib for Flutter dio like RxCache
Apache License 2.0
274 stars 223 forks source link

Make CacheStore configurable #33

Closed chimon2000 closed 3 years ago

chimon2000 commented 4 years ago

It would be nice to be able to pass in your own version of CacheStore so that users are able to implement using different databases, such as Hive or Moor.

ariefwijaya commented 4 years ago

Yes,. I think so. Up. @hurshi

pishguy commented 4 years ago

+1

hurshi commented 3 years ago

Hello, thanks for your issue. It's supported now (0.2.11):

DioCacheManager(CacheConfig(baseUrl: "https://www.github.com/", diskStore: MyDiskStore()))
class MyDiskStore implements ICacheStore {
  @override
  Future<bool> clearAll() {
    // TODO: implement clearAll
    throw UnimplementedError();
  }

  @override
  Future<bool> clearExpired() {
    // TODO: implement clearExpired
    throw UnimplementedError();
  }

  @override
  Future<bool> delete(String key, {String subKey}) {
    // TODO: implement delete
    throw UnimplementedError();
  }

  @override
  Future<CacheObj> getCacheObj(String key, {String subKey}) {
    // TODO: implement getCacheObj
    throw UnimplementedError();
  }

  @override
  Future<bool> setCacheObj(CacheObj obj) {
    // TODO: implement setCacheObj
    throw UnimplementedError();
  }
}