I'm trying to Implement 2 behaviors in my system using Hiredis and Redis. 1) fetch all keys with pattern by publish event and not by the array returning when using SCAN command. (my system works only with publish event even for get so need to stick to this behavior) 2) delete all keys with pattern
After reading the manuals I understand that "SCAN" command is my friend. I have 2 approaches, not sure what is the pros/cons:
1) Using Lua script that will call SCAN until we get 0 as our cursor and publish-event/delete-key for each entry found. 2) Using Lua script but return the cursor as the return code and call the LUA script from the hiredis client with new cursor until it gets 0.
Or maybe other ideas will be nice.
My database is not hugh at all .. not more than 500k entries with key/val that are less then 100 bytes.
Thank you!