php mcache exension: 1.1.0 features/fixes list

John McCaskey johnm at
Thu Jan 27 01:41:57 PST 2005

I've spent some time today working on the next version of my php extension based off libmemcache.  I'm posting the list of changes/fixes I've come up with so far for community review and comments.
1) In the intial release, bools, longs, doubles, and strings were all returned as strings, due to the way types work in php this would normally work fine, but now they return in the exact same type as they were when you set them.
2) flags is not an option to set, add, or replace commands.  The flags field was never able to be retrieved from getcommand, and it is used internally by the extension to keep track of types and serialization.  As such I think the best thing to do is not support it from an end user perspective.  If you need flags do something like $mc->set('key', Array('val'->myvalue, 'flags'->myflags));  This breaks the api for set, add, and replace, but its pretty trivial.  The version number will bump to 1.1.0 to indicate this.
1) Persistent memcache objects/connections.  
The thing that is problematic is that you only want to add each server once, I'm probably going to end up keeping track of which servers have been added internally in the object, and then detecting duplicate calls and ignoring them.  Then it would look like:
$mc = pmemcache('unique key for this object');
if($mc) {
  $mc->add_server('localhost', '11211');  // this is only actually run the first time its called on the persistent object
  //set/get/whatever as usual
The only other option I came up with was to pass an array of servers to the pmemcache() function itself, but I like not doing that as calling add_server as stated in the above option seems more flexible in allowing new servers to be added later without creating a new object.
Anyway, this is 99.9% functional (just need to fix duplicate calls to add_server to not keep adding more connections), and I did some testing of it tonight.  I plan to get everything finished and tested within the next couple of days and I'll push the code out to the site.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the memcached mailing list