dnn.rediscachingprovider icon indicating copy to clipboard operation
dnn.rediscachingprovider copied to clipboard

Clear cache with prefix key and improve performance

Open krurkrit opened this issue 9 years ago • 3 comments
trafficstars

I found redis caching provider always clear all data in cache.

When clear cache with prefix key, it should clear only key with specific prefix. Ex. Given 3 keys below Portal-1_ Portal-1_en-US Portal-2

If DNN call method Clear in RedisCachingProvider.cs and send type = 'Prefix', data = 'Portal-1'. It should clear Portal-1_ and Portal-1_en-US, not clear cache with key Portal-2.

Moreover, the existing code loops for clearing. I suggest to send Lua script to loop on server side to clear cache.

I provide code at http://pastebin.com/itZH6Az7

Could you please review and update RedisCachingProvider version 1.0.4 (I use DNN 7.4.x)?

Best regards, Gai

krurkrit avatar Apr 21 '16 13:04 krurkrit

I love it! Going to add the change to work with 7.4.x and 8.x versions

davidjrh avatar Apr 21 '16 15:04 davidjrh

Thank you :)

Howerver, I think it have to improve clear cache for other key types (ex. PortalCascade). I will update when I know

krurkrit avatar Apr 21 '16 16:04 krurkrit

I have added the LUA script on the 2.1.0 version. I will revisit this to find a way of partially clearing the keys.

davidjrh avatar Sep 04 '16 19:09 davidjrh