Package libmemcache-1.4.0.rc2-1
| System | Binary Distributions | CVS/rsync Source Distributions | |
|---|---|---|---|
10.7/x86_64 | 1.4.0.rc2-1 | ||
10.6/x86_64 | |||
10.6/i386 | |||
10.5/i386 | |||
10.5/powerpc | |||
| Description: | C API for building memcached clients (1.4.0.rc2-1) | |||
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. | ||||
| Usage Hints: | ||||
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); | ||||
| Section: | libs | |||
| Maintainer: | Alexey Zakhlestin <indeyetsATgmailDOTcom> | |||
| Website: | http://people.freebsd.org/~seanc/libmemcache/ | |||
| License: | BSD | |||
| Info-File: | dists/10.7/stable/main/finkinfo/libs/libmemcache.info CVS log, Last Changed: Fri, 13 Jan 2012 23:16:42 (UTC) | |||
| SplitOffs: |
| |||
Section list - Flat package list - Search packages
(*) = Unsupported distribution.