strapi-middleware-cache icon indicating copy to clipboard operation
strapi-middleware-cache copied to clipboard

WIP proposal to split into many adapters

Open agutoli opened this issue 2 years ago • 6 comments

This is a proposal to split this plugin into optional cache adapters.

Why?

  • It makes the package smaller.
  • It allows installing only necessary dependencies like ioredis, redis-lru.
  • More scalable to implement alternative cache servers without increasing package size.

WIP

This is a proposal only, not fully implemented.

agutoli avatar Nov 26 '21 12:11 agutoli

Good stuff, I like it ! 🚀

@stafyniaksacha has been migrating a whole bunch of Strapi things to Typescript, when that becomes more available the adapter packages could benefit from a typescript interface as well.

patrixr avatar Nov 27 '21 04:11 patrixr

I like the idea too :)

Just a small niptipping, can we rename "strapi-middleware-cache-mem-adapter" to something like "strapi-middleware-cache-in-memory-adapter" to avoid confusing with "memcached" ?

stafyniaksacha avatar Nov 28 '21 10:11 stafyniaksacha

I have some suggestions since we have lightly discussed making this a plugin for v4 (in which case the package would be renamed to strapi-plugin-cache)

Likewise since we (Strapi) use the strapi-provider-* syntax (for v4 they will actually be @strapi/provider-*) I would suggest we follow a similar syntax.

Other than that I totally think this is a fantastic idea. A fellow community member @mattiebelt is working on a search plugin that is planning to use this same structure.

(I might suggest hold off on merging this until we figure out how best to rewrite this for v4 though)

derrickmehaffy avatar Nov 29 '21 05:11 derrickmehaffy

Likewise since we (Strapi) use the strapi-provider-* syntax ...

👍 Totally agree

(I might suggest hold off on merging this until we figure out how best to rewrite this for v4 though)

May we start creating an RFC for this plugin ? (I plan to work again on this in one or two weeks)

stafyniaksacha avatar Nov 29 '21 17:11 stafyniaksacha

Likewise since we (Strapi) use the strapi-provider-* syntax ...

+1 Totally agree

(I might suggest hold off on merging this until we figure out how best to rewrite this for v4 though)

May we start creating an RFC for this plugin ? (I plan to work again on this in one or two weeks)

For sure, please feel free. I should be free to discuss later this week after the v4 stable release.

derrickmehaffy avatar Nov 29 '21 21:11 derrickmehaffy

Hello @agutoli !

I have implemented the provider system for the V4 release here: https://github.com/patrixr/strapi-middleware-cache/tree/feature/strapi-v4/packages

Please feel free to give your feedback!

stafyniaksacha avatar Jan 11 '22 13:01 stafyniaksacha