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:
Search speed: the new implementation directly uses the database engine to execute the Regex matching.
Because the database cannot do complex query parameter matching, this is done afterwards.
However, with this we can already exclude large amounts of entries from being searched.
Memory usage: the new implementation does not export the entirety of the data from the database, resulting in much lower memory usage. Instead, we only fetch the cache key and url, which is enough for the purpose of deleting entries.
Operation speed: the new implementation executes all database operations at once, using only one transaction for search, and one for delete, allowing faster database code to take over.
The existing test suite for this code runs as expected.
The code introduces no breaking changes and can be released as a patch version.
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.