the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: libmemcache
Version: 1.4.0.rc2
Revision: 1
DocFiles: COPYING ChangeLog
Description: C API for building memcached clients
License: BSD
Maintainer: Alexey Zakhlestin
Homepage: http://people.freebsd.org/~seanc/libmemcache/
Source: http://people.freebsd.org/~seanc/libmemcache/%n-%v.tar.bz2
Source-MD5: 402c957cd71538c07a263542eeb513d1
Source2: http://people.freebsd.org/~seanc/libmemcache/README
Source2-MD5: 0fe380e6247be8daa826ee561053de63
Source2Rename: %n-%v-README
BuildDependsOnly: true
Depends: %n-shlibs
ConfigureParams: --disable-dependency-tracking
CompileScript: <<
./configure %c
make
<<
InstallScript: <<
make install prefix=%i bindir=%i/sbin mandir=%i/share/man
mkdir -p %i/share/doc/%n
cp ../%n-%v-README %i/share/doc/%n/README.html
<<
SplitOff: <<
Package: libmemcache-shlibs
Description: Library for building memcached clients
Files: <<
lib/libmemcache.0.4.0.dylib
lib/libmemcache.0.dylib
share
<<
Shlibs: <<
%p/lib/libmemcache.0.dylib 5.0.0 %n (>= 1.4.0.rc2-1) 32
<<
<<
DescDetail: <<
Features:
* Support for Multiple Memory Contexts. This is primarily used for programs
that need to use memcache(3) inside of Apache where both Apache and PHP
have their own memory management systems.
* Callback Interface. Using the callback interface, it is possible to lump
many gets together into a single get request with a great deal of ease.
* Multiple Client Side Hashes. memcache(3) supports multiple hashing methods
to distribute load across multiple servers.
* Multiple Servers. memcache(3) supports multiple servers.
* Support for Garbage Collection. memcache(3) was written with the Bohem
Garbage Collector in mind.
* MIT Licensed. memcache(3) is as Open Source as it gets and can be embedded
in anything (commercial software, open source, etc). May the GPL and its
users rot in hell for their stupidity.
<<
DescUsage: <<
memcache.h is very well commented and the best place to look for
documentation (for now). The following examples use the single memory
context API (what most programs will use), but could easily be converted to
the multi-memory context API. See memcache.h.in for details.
/* Create a new memcache instance */
struct memcache *mc = mc_new();
/* Add a few servers */
mc_server_add(mc, "127.0.0.1", "11211");
mc_server_add(mc, "127.0.0.1", "11212");
mc_server_add4(mc, "127.0.0.1:11213");
/* Add a key */
mc_add(mc, key, keylen, val, bytes, expire, flags);
/* Get a key, caller has to free(3) memory */
void *blah = mc_aget(mc, key, keylen);
free(blah);
/* Perform a multi-key request */
struct memcache_req *req = mc_req_new();
mc_req_add(req, key1, key1_len);
mc_req_add(req, key2, key2_len);
mc_get(mc, req);
/* Process the results
(need a better interface to looping through results)
*/
/* Perform a multi-key request the easy way
(this is my preferred way of getting data):
*/
req = mc_req_new();
res1 = mc_req_add(req, key1, key1_len);
res2 = mc_req_add(req, key2, key2_len);
mc_get(mc, req);
/* Play with res1/res2 w/o any looping through req */
/* Complex multi-key get example: */
/* Grab the response object that will be used to store a given key */
struct memcache_res *res = mc_req_add(req, key3, key3_len);
/* Allocate our own memory a head of time (useful for loops) */
res->size = 1024;
res->val = malloc(res->size);
mc_res_free_on_delete(res, 1);
/* Perform the get */
mc_get(mc, req);
mc_res_free(req, res);
/* Get stats from the whole cluster */
struct memcache_server_stats *s = mc_stats(mc);
mc_server_stats_free(s);
/* Storage commands: */
mc_add(mc, key, key_len, val, bytes, expire, flags);
mc_replace(mc, key, key_len, val, bytes, expire, flags);
mc_set(mc, key, key_len, val, bytes, expire, flags);
/* Delete commands: */
mc_delete(mc, key, key_len, hold_timer);
/* Atomic opts: */
mc_incr(mc, key, key_len, 1);
mc_decr(mc, key, key_len, 1);
mc_free(mc);
<<