People ask me all the time why I create Couchbase key patterns with double colons as a delimiter. Well…
-
Not::much::else::uses::double::colons so it is a great delimiter
-
They make for human readable keys
-
Every object in Couchbase needs a unique key per bucket and since I need to find my object fast, I want the option of getting the object from Couchbase by the key and right from the managed cache.
-
When it comes to using #N1QL, I can use this key pattern there too. I double my usefulness.
In addition, I have text in my key that is meaningful to my application and it can piece together quickly to find that object.
So for a user session store, I might have an object that is user-session::cart::username123. As long as the application has the username or some other unique value of that user, I know the application can get the user's shopping cart object as fast as Couchbase is known for.