hurshi / dio-http-cache

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

Custom key #7

Closed pchampio closed 5 years ago

pchampio commented 5 years ago

DOC: dio-http-cache uses url as key. Letting the user define custom keys for caching would enable users to share cache between requests.

Such a feature is interesting in the following example: http://example.com/a/b http://example.com/a/b?timestamp=1566563506431 http://example.com/a/b?timestamp=1566563506433 The API needs a timestamp GET parameter that cannot be shared between requests, be we would like to save them as ONE request in sqflite. (for MaxStale fallback)

The above case can also be solved by providing queryParameters at the buildCacheOptions level, where they could be ignore by the hash method.

hurshi commented 5 years ago

Hi,thanks for your issue, Sorry about the confusion caused by readme, I have solved this problem in the latest version. There was a discussion about this issue in issue6. In the mean time, I've also updated readme. If you have any question, please feel free to let me know.

pchampio commented 5 years ago

Thanks!