[announce] php: mcache extension 1.0
adam at digitalagemedia.net
Tue Jan 18 22:39:55 PST 2005
[announce] php: mcache extension 1.0Hey John,
Glad to see you've made some progress with this. I use the PECL extension and would be happy to
use something based off of Sean's libmemcache. Can this extension be compiled in statically like the
I'd also like to see some more benchmarks when you get a chance. Documentation included inside the source tarball would be helpful as well, a README or INSTALL file.
----- Original Message -----
From: John McCaskey
To: John McCaskey ; memcached at lists.danga.com
Cc: Sean Chittenden
Sent: Tuesday, January 18, 2005 10:33 PM
Subject: [announce] php: mcache extension 1.0
See attached source code.
Unfortunately libmemcache uses the "%hu" and "%zu" format specifiers which at least on my box (linux 2.6.10, php 4.3.10) break inside of php extensions for some reason, so to make this actually compile you must patch your libmemcache 1.2.0 source to just use "%u", use the attached patch file for this.
Then to install the extension follow the below steps after extracting:
$ ./configure --with-mcache=/path/to/patched/libmemcache/source/
$ make install
then add mcache.so to your php.ini.
You can look at the following examples for usage, or view the mcache.c file which has PECL standard comments about the functions.
$mc = memcache();
// This returns FALSE on miss
$val = $mc->get('key1');
// This returns an associative array with
// an entry for each key found, a miss will simply result
// in no entry in the array for that key.
$val = $mc->get(Array('key1', 'key2'));
Thats the basics, the remaining supported commands are: stats, incr, decr, flush_all, which should be pretty easy to figure out.
Please feel free to send feedback and/or bug fixes :) This is my first php extension although I'm experienced in both php and c, writing primarily c code lately. So I wouldn't be shocked to find that I haven't done everything perfectly.
Oh, and finally a note on licensing, I've left in the php header which claims the code is subject to the php license. I'm not sure how the php license works and if I can change it freely to whatever license I want or what. I basically don't care what you do with this, feel free to use it and make changes, redistribute, use in commercial projects, whatever. If you are concerned about the license feel free to contact me.
John A. McCaskey
Software Development Engineer
Klir Technologies, Inc.
johnm at klir.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the memcached