People ask me all the time why I create Couchbase key patterns with double colons as a delimiter. Well…

  1. Not::much::else::uses::double::colons so it is a great delimiter

  2. They make for human readable keys

  3. 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.

  4. 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.


Posted by Kirk Kirkconnell, Senior Solutions Engineer, Couchbase

Kirk Kirkconnell was a Senior Solutions Engineer at Couchbase working with customers in multiple capacities to assist them in architecting, deploying, and managing Couchbase. His expertise is in operations, hosting, and support of large-scale application and database infrastructures.

Leave a reply