On Jul 17, 2007, at 11:21 , BUSTARRET, Jean-francois wrote:
I'm not a very experienced C coder, but I'll try to share some
ideas... Please be tolerant
- add "char* tags" to the _stritem struct
- store tags in a comma/whatever-delimited string :
",tag1,tag2,tag3," (space and comma being reserved), the client
being eventually responsible for formatting the tag string
- modify the protocol to add an optional tag parameter <command
name> <key> <flags> <exptime> <bytes>[ <tags>]\r\n
- add a new deletetag command ?
- delete items using the same rule approach as described by Dustin,
strpos-ing(",tag,") instead of regexp-ing the key
Multi-tag deletes can be split in multiple rules
IMHO, limiting the max number of tags and the max size of a tag
would not be a problem.
We wouldn't want to modify the existing commands to also take tags
versus adding new commands to deal with the management of tags.
That's a good start, and it seems that it could work. I'd be
concerned that you're storing a lot more information in a lot more
places, though. If you just stored the tags in the key and used the
regex cleanup, you'd get the same effect without changing the storage
strategy too much and without having to do any protocol modification
other than adding the delete-by-pattern command.
--
Dustin Sallings