strapi-community/strapi-plugin-rest-cache

Any way to cache only plural and not singular endpoints?

davidkcyip opened this issue · 4 comments

Hi, as the title says, would like to only cache plural endpoints like /articles and not /articles/1

+1. any idea if this is possible @stafyniaksacha ?

You will have to disable default routes (injectDefaultRoutes: false) and defines yours https://strapi-community.github.io/strapi-plugin-rest-cache/guide/strategy/cache-custom-routes.html

Let me know if that does what you needs

I couldn't get this to work. Do you have an example config that I could try that caches queries to /articles, including pagination and fields returned. i.e. that would cache a query such as this:

/articles?fields[0]=id&fields[1]=title&fields[2]=slug&fields[3]=summary&populate[0]=coverImage&populate[1]=category&sort=publishedAt:desc&pagination[start]=1&pagination[limit]=12

Thanks

kutsan commented

I'd love to get help on this one too.