llfbandit / dio_cache_interceptor

Dio HTTP cache interceptor with multiple stores respecting HTTP directives (ETag, Last-Modified, Cache-Control) with options.
https://pub.dev/packages/dio_cache_interceptor
119 stars 70 forks source link

feat: fast delete for db store #147

Open clragon opened 6 months ago

clragon commented 6 months ago

The current implementation of deleting cache entries, via a given path, in the db cache store implementation, is very slow.

It manually exports 10 database cache entries at a time, checks them against the regex and query parameters, and then processes them.

I assume the current implementation has been written with a concern for memory usage in mind, but as a result can lead to large waiting times.

I propose this new implementation. It conforms to our goals and allows us to speed up the process:

The existing test suite for this code runs as expected. The code introduces no breaking changes and can be released as a patch version.

llfbandit commented 6 months ago

Thanks for your contribution. It seems really good despite the few comment I made.