I have a database with files which can be searched, browsed and have multiple copies on multiple servers.
I cache searches, browse pages and server locations (urls). Say
See Organizing memcache keys
Unless you can "master key" items, there's no sane way to do this. By this I mean something like "user4231-is_valid". You could check that for anything that used that user's data. Otherwise, unless you're tracking everything that references your file in question, you can't invalidate all of them. If you do that, you still have to iterate all possibilities in order to successfully delete.
Document your dependencies, limit your dependencies, track your dependencies in your code for deletion activities.
I have no experience with memcached, but I understand that IO are cheap there.
I'd go with your tag implementation, make sure the tag list is used frequently and hope that the internal mmcd' logic would "think" that it's something too busy to be dropped :)
Having come accross the comment here, which explains the logic of evicting existing keys, I believe tags can be implemented reliable by the version flags approach mentioned in: PHP memcache design patterns
I actually implemented this logic once already, but discarded it as unreliable due to memcache eviction of elements before they expire. You can find my initial implementation here. I do however, believe this is a reliable tags pattern because:
Please correct me if I'm wrong! :-)