16.6.3 Developing a memcached Application Basic memcached Operations Using memcached as a MySQL Caching Layer Using libmemcached with C and C++ Using MySQL and memcached with Perl Using MySQL and memcached with Python Using MySQL and memcached with PHP Using MySQL and memcached with Ruby Using MySQL and memcached with Java Using the memcached TCP Text Protocol

A number of language interfaces let applications store and retrieve information with memcached servers. You can write memcached applications in popular languages such as Perl, PHP, Python, Ruby, C, and Java.

Data stored into a memcached server is referred to by a single string (the key), with storage into the cache and retrieval from the cache using the key as the reference. The cache therefore operates like a large associative array or hash table. It is not possible to structure or otherwise organize the information stored in the cache. To emulate database notions such as multiple tables or composite key values, you must encode the extra information into the strings used as keys. For example, to store or look up the address corresponding to a specific latitude and longitude, you might turn those two numeric values into a single comma-separated string to use as a key.