strapi-community / strapi-plugin-rest-cache

Speed-up HTTP requests with LRU cache.
https://strapi-community.github.io/strapi-plugin-rest-cache/
MIT License
129 stars 29 forks source link

fix(purge-rest-cache): cannot purge with redis #16

Closed vhnam closed 2 years ago

vhnam commented 2 years ago

Hello everyone, I'm getting same issue with these issues on my production.

  1. https://github.com/strapi-community/strapi-plugin-rest-cache/issues/11
  2. https://github.com/strapi-community/strapi-plugin-rest-cache/issues/2

It means, i'm using Redis to cache and while clicking on the "Purge REST Cache" button then it doesn't work.

After debugging then i see the cause is the shouldDel at https://github.com/strapi-community/strapi-plugin-rest-cache/blob/e37ca174a7bb10c543edadbc12c0f8c52ed1f6cb/packages/strapi-plugin-rest-cache/server/services/cacheStore.js#L187 always returns an empty array so that we can't purge. What we expect that it returns an array with expected keys will be deleted.

Another issue, i'm using keyPrefix for my Redis and shouldDel compared with the key without keyPrefix.

Thank you.