Chapter 9. Libmemcached
The Perl module for memcached, Cache::memcached, is a client library for accessing memcached that is written entirely in Perl. This was the first client library for memcached and works just fine for most applications. Though, as any programmer knows, there is always room for more efficiency and speed, and sometimes you just have to implement code in C if you need speed. Brian Aker had a need for such a thing and started a new client library for memcached: libmemcached.
What Is libmemcached?
libmemcached is a memcached client library written in C. It is a faster, more efficient, thread-safe, full-featured C library that has a significant performance gain over existing client libraries. Not only that, you also have much more control to affect how the client functions because you can set the client behavior (memcached_behavior_set()
) with numerous behavior settings, such as hashing algorithm or whether the client is blocking or nonblocking, CAS (Check and Set) support, server host sorting, etc.
Perl support for libmemcached comes in two approaches: a lower-level one-to-one C API mapping Memcached::libmemcached and Cache::memcached::libmemcached, which is a drop-in replacement for Cache::memcached. This chapter will explain both of these in greater detail.
Do you want to use libmemcached instead of Cache::memcached? It is much newer than Cache::memcached and some developers or administrators shy from using newly released software, but its performance benefits and ...
Get Developing Web Applications with Perl, memcached, MySQL® and Apache now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.