check if an item exists
Mon, 06/18/2012 - 01:49
Hi, is there a way to check if an item exists without using "add" or "touch" or "get"?
thanks
Mon, 06/18/2012 - 21:16
What is exactly the name of this undocumented feature, i couldn't find it?
thanks
Mon, 06/18/2012 - 21:33
It's simply an argument to the stats command for the key you want information on.
It's actually documented at a code level right here:
https://github.com/couchbase/ep-engine/blob/master/docs/stats.org#29-sta...
With Open Source, everything is technically documented. :)
Mon, 06/18/2012 - 21:34
Oh, and by the way, you can try it from either your client library or the commandline cbstats.
There is a feature, currently undocumented (and thus unsupported) called stats key. It may be documented/supported soon, but you can certainly try it in a test environment to see if it works for you. This would allow you to get information about a given key without actually retrieving it. No stats on the key would mean it doesn't exist yet.
Of course, an add with expiration 1 is pretty close if you expect it to not really exist. I know that's not quite right though.