0

I am using NestJs CacheModule for caching purposes in my application. I want to clear the cache based on a particular key pattern (based on a Regex pattern). I tried to use cacheManager.del(key) but it is not working based on regex expression instead looking for an exact match. Say I have the following data saved in my cache,

customer-1 : name1
customer-2: name2
order-1: order1Details
order-2: order2Details

I am looking for a method where calling cacheManager.del('customer-*') would delete all customer records whereas order records stay intact. Are there any built-in methods available for this purpose in NestJs CacheModule? Is there any other workaround that won't affect performance?

sebin vincent
  • 330
  • 3
  • 12

0 Answers0