There is no "delete by pattern" in Redis. To do what you describe involves using KEYS or (preferably) SCAN to iterate the entire keyspace, and lots of DEL commands. KEYS and SCAN *are* inherently slow on large keyspaces (although SCAN at least allows this to be spread over multiple calls). Personally, I would question why you need a scenario that would involve "delete by pattern". I'd be tempted to partition by database and use FLUSHDB instead (although to be fair: database numbers are technically now obsolete, iirc)
Marc
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.
> delete by pattern can be achieved with lua script
That may be the most horrifying use of Lua scripting I've ever heard of. That's like... take the 2 easiest ways to block a Redis server, and **combine them**.
IMO the trick here is to explicitly index the sub-keys so you can just list them directly.
Itamar Haber | Chief Developer Advocate
Redis Watch Newsletter | Curator and Janitor
Redis Labs | ~ of Redis
Mobile: +1 (415) 688 2443
Office: +1 (650) 461 4652
Mobile (IL): +972 (54) 567 9692
Office (IL): +972 (3) 720 8515 Ext. 123
Email: ita...@redislabs.com
Twitter: @itamarhaber
Skype: itamar.haber
Thanks Itamar Haber. Looks like Sorted Set would fit for my requirement ..Sorry i didnt explain my question properly ..Here is my data structure:Key ==> pathValue ==> { List of values like SIZE , who is parent }
Ex: /user/senthil/data/cust_data.txt {"size" : "20MB" , "parentPath":"/user/senthil/data"}/user/senthil/data {"size" : "20MB" , "parentPath":"/user/senthil"}/user/senthil {"size" : "20MB" , "parentPath":"/user"}/user {"size" : "20MB" , "parentPath":"/"}Parent Path is to Query and build the Tree structure ..
If i Jump to Sorted Set from Key Value Pairs , data structure Would beAdding Elements :ZADD hdfsfilesystem 0 /user/senthil/data/cust_data.txt:20MB:/user/senthil/dataZADD hdfsfilesystem 0 /user/senthil/data:20MB:/user/senthilZADD hdfsfilesystem 0 /user/senthil:20MB:/userZADD hdfsfilesystem 0 /user:20MB:/
How do i update element ?? Example .. Currently /user/senthil/data/cust_data.txt size is 20 MB .. If suppose i want to update this Size to 40 MB .. How to update this in Single Call ??
Also how do i query path /user/senthil/data/cust_data.txt ?? ..