feathers-hooks-rediscache icon indicating copy to clipboard operation
feathers-hooks-rediscache copied to clipboard

Limit keys per endpoint, add purge hook

Open sarkistlt opened this issue 5 years ago • 2 comments

First thank you for library really helpful!! Just a couple suggestion to improve:

  • would be nice to have hooks to purge cache lets say after patch or create
  • also would be really great to be able to set a limit let's say store only latest 100 keys per endpoint etc. could be really useful.

sarkistlt avatar Apr 19 '19 23:04 sarkistlt

For the first point, you can easily call the the invalidation route with the required params, and it could be done in a hook.

But indeed we could do a generic hook for that I will try to make the time.

The second point is a good idea, just a question do you have storage issues with redis? Routes will be automatically deleted when they expire.

idealley avatar Apr 20 '19 20:04 idealley

for the second one I don’t have any problems with the storage but it’s still useful to have control on the quantity of the keys per endpoint. Just an example, any eCom. site, user will login and shop for ~15m, and we have 500k users in db and ~100 real time users at a time. Of corse we don’t want to use cache in this case as it is because it will blow redis, but if we can limit it let’s say by 500 entries then it will solve this problem and will increase querying speed for online users

sarkistlt avatar Apr 20 '19 22:04 sarkistlt