dabroek / node-cache-manager-ioredis

Redis store for node-cache-manager using IORedis.
MIT License
59 stars 29 forks source link

reset() drops the whole database #31

Closed andrew-sol closed 2 years ago

andrew-sol commented 2 years ago

It's ridiculous. Sure dropping everything is an easy way to go but it shouldn't work like that. Maybe flushdb functionality could be configurable?

How you can solve this (together with another organization problem): 1) Introduce a cache key prefix. It should be configurable but never empty. Default value: 'cache'. 2) Add the prefix to each key passed into get/set/del methods. It should be separated with the key by a colon ':' (e.g. 'cache:custom_cache_key'). 3) Make reset method to delete all keys starting with the prefix.

nick4fake commented 1 year ago

Why is this completed?