<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>RE: [announce] php: mcache extension 1.0</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Adam,<BR>
<BR>
The extension can be compiled in statically just like the PECL one, the basic steps should be:<BR>
1) Extract inside of php-x.x.x/ext/ directory<BR>
2) run ./buildconf from base of php source dir (may tell you to use --force if you are using a release package)<BR>
3) run ./configure 'all your normal options' --with-mcache=/path/to/patched/libmemcache/source<BR>
4) make<BR>
5) make install<BR>
<BR>
Let me know if you try this and have problems, it works for me.<BR>
<BR>
I'd also like to see more benchmarks myself :) I'll do some when I have time, the big feature of this client over the current PECL one is that it supports multiple servers, that alone may increase performance substantially if you have a cluster of servers.<BR>
<BR>
As for docs, completely agree... I'll get around to it before too long.<BR>
<BR>
John<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Adam Michaels [<A HREF="mailto:adam@digitalagemedia.net">mailto:adam@digitalagemedia.net</A>]<BR>
Sent: Tue 1/18/2005 10:39 PM<BR>
To: John McCaskey<BR>
Cc: memcached@lists.danga.com<BR>
Subject: Re: [announce] php: mcache extension 1.0<BR>
<BR>
[announce] php: mcache extension 1.0Hey John,<BR>
<BR>
Glad to see you've made some progress with this. I use the PECL extension and would be happy to<BR>
use something based off of Sean's libmemcache. Can this extension be compiled in statically like the<BR>
PECL extension?<BR>
<BR>
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.<BR>
<BR>
Thanks.<BR>
&nbsp; ----- Original Message -----<BR>
&nbsp; From: John McCaskey<BR>
&nbsp; To: John McCaskey ; memcached@lists.danga.com<BR>
&nbsp; Cc: Sean Chittenden<BR>
&nbsp; Sent: Tuesday, January 18, 2005 10:33 PM<BR>
&nbsp; Subject: [announce] php: mcache extension 1.0<BR>
<BR>
<BR>
&nbsp; See attached source code.<BR>
<BR>
&nbsp; Unfortunately libmemcache uses the &quot;%hu&quot; and &quot;%zu&quot; 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 &quot;%u&quot;, use the attached patch file for this.<BR>
<BR>
&nbsp; Then to install the extension follow the below steps after extracting:<BR>
&nbsp; $ phpize<BR>
&nbsp; $ ./configure --with-mcache=/path/to/patched/libmemcache/source/<BR>
&nbsp; $ make<BR>
&nbsp; $ make install<BR>
<BR>
&nbsp; then add mcache.so to your php.ini.<BR>
<BR>
<BR>
&nbsp; You can look at the following examples for usage, or view the mcache.c file which has PECL standard comments about the functions.<BR>
<BR>
&nbsp; &lt;?php<BR>
<BR>
&nbsp; $mc = memcache();<BR>
<BR>
&nbsp; $mc-&gt;add_server('127.0.0.1', '11211');<BR>
&nbsp; $mc-&gt;add_server('127.0.0.1', '11212');<BR>
<BR>
&nbsp; $mc-&gt;set('key1', 'value_one');<BR>
&nbsp; $mc-&gt;add('key2', 'value_two');<BR>
&nbsp; $mc-&gt;replace('key2', 'two_value');<BR>
<BR>
&nbsp; // This returns FALSE on miss<BR>
&nbsp; $val = $mc-&gt;get('key1');<BR>
<BR>
&nbsp; // This returns an associative array with<BR>
&nbsp; // an entry for each key found, a miss will simply result<BR>
&nbsp; // in no entry in the array for that key.<BR>
&nbsp; $val = $mc-&gt;get(Array('key1', 'key2'));<BR>
<BR>
&nbsp; $mc-&gt;delete('key1');<BR>
<BR>
&nbsp; ?&gt;<BR>
<BR>
&nbsp; Thats the basics, the remaining supported commands are: stats, incr, decr, flush_all, which should be pretty easy to figure out.<BR>
<BR>
&nbsp; Please feel free to send feedback and/or bug fixes :)&nbsp; This is my first php extension although I'm experienced in both php and c, writing primarily c code lately.&nbsp; So I wouldn't be shocked to find that I haven't done everything perfectly.<BR>
<BR>
&nbsp; Oh, and finally a note on licensing, I've left in the php header which claims the code is subject to the php license.&nbsp; I'm not sure how the php license works and if I can change it freely to whatever license I want or what.&nbsp; I basically don't care what you do with this, feel free to use it and make changes, redistribute, use in commercial projects, whatever.&nbsp; If you are concerned about the license feel free to contact me.<BR>
<BR>
&nbsp; --<BR>
&nbsp; John A. McCaskey<BR>
&nbsp; Software Development Engineer<BR>
&nbsp; Klir Technologies, Inc.<BR>
&nbsp; johnm@klir.com<BR>
&nbsp; 206.902.2027<BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>