Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Using Memcached to Explore NoSQL

DZone's Guide to

Using Memcached to Explore NoSQL

· Database Zone
Free Resource

Learn how to create flexible schemas in a relational database using SQL for JSON.

James Downey is a computer programmer with a passion for learning and writing about new technologies. He blogs at www.CloudOfInnovation.com. At the moment, he’s writing a series exploring NoSQL. Enjoy the content and share your thoughts. Twitter: james_downey.

Memcached might seem an odd place to venture in an exploration of NoSQL databases. It is not a database. It provides no persistence. It purges items from memory to free space as needed. And there is no replication. If data gets lost, an application retrieves it anew from a persistent data store.

Rather than a database, Memcached is a distributed memory cache of key-value pairs. Its application programming interface follows the pattern of a hash table. Using a key, programmers set and get values, which could be anything. Yes, memcached increments and decrements numeric values, but in general it understands nothing about the structure of values stored in its memory. It neither indexes nor searches based on values. To use a value, a programmer must retrieve it via a key and convert it to an object defined in the programming language.

To use Memcached, install and run the service on one or more servers. (I literally had it up and running on Ubuntu in minutes.) And install the driver for your programming language of choice. In code, indicate the Memcached servers in use and begin to set and get key-value pairs. The client code included in the driver distributes your data across servers based on a hashing algorithm. The Memcached servers do not need to communicate with each other. The system is remarkably simple, which explains its appeal.

Memcached users include Twitter, YouTube, Flickr, Craigslist, and WordPress.com, the host of this blog. Indeed, you are now reading words that were likely cached in Memcached.

So why consider Memcached in this exploration of NoSQL? I take this detour because as we explore NoSQL databases, it will be useful to compare their functionality to Memcached, with Memcached serving as an example of extreme simplicity. Hopefully, this point will become more apparent in my next post as I explore Redis.

Source:  http://webcache.googleusercontent.com/search?q=cache:001pUSjbjwwJ:cloudofinnovation.com/+&cd=1&hl=en&ct=clnk&gl=us&client=firefox-a

Create flexible schemas using dynamic columns for semi-structured data. Learn how.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}