I have two apps connecting to memcached servers on different namespaces, for example's sake we'll call them "admin" and "users".
Every now and then I want to expire some fragments in the "users" namespace from the admin application.
Note: I am not caching/expiring actions as per the other several questions/answers I found here. I want to expire keys such as "abcde". I cache all sorts of things, AR results, JSON, and so on.
Already tried things like:
Rails.cache.delete("abcd")
Rails.cache.delete("users/abcd")
Rails.cache.delete("/users/abcd")
Digests are off.
How do I do this?
If your rails cache is configured with a namespace, that namespace will be prepended to the cache key automatically. So, when you Rails.cache.write("FOO", "BAR")
the key will actually be $NAMESPACE:FOO
. Keys are just strings and can't be navigated like a file system or anything fancy (AFAIK).
I think your best option is instantiate a separate instance of a dalli client for your alternative namespace to delete the key.