Sharing cache objects between PERL and PHP

The Newb ne_wb at hotmail.com
Fri Jun 22 21:20:13 UTC 2007


 
Hello,
 
I'm using Cache::Memcached on the PERL side and the PECL libraries for PHP in PHP 4.x. The data objects are session data that I would like to share between both languages, however when I telnet straight into the memcache daemon and do gets on the keys, it appears that the data objects are stored in completely different formats. Do I have a setting wrong, is this a permanent limitation, wrong library or not enough RTFM? It works fine in either language. I'm just missing the cross-compatability. If someone could point me toward correct answer, it would be much appreciated. 
 
Thanks
 
### PERL EXAMPLE
 
use Cache::Memcached;require Digest::MD5;my $memd = new Cache::Memcached {    'servers' => [ "127.0.0.1:11211"], debug => 1  };$memd->enable_compress(0);$sess_id = "d116f2af6b07deaac588c8c34cca919b";$session->{'first'} = "john";$session->{'last'} = "smith";$session->{'session_id'} = $sess_id;  $memd->set("$sess_id", $session,60);
 
 
### MEMCACHE RESULT
 
telnet 127.0.0.1 11211Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.get d116f2af6b07deaac588c8c34cca919bVALUE d116f2af6b07deaac588c8c34cca919b 1 85
 d116f2af6b07deaac588c8c34cca919bsession_idjohnfirstsmithlastEND
 
### PHP EXAMPLE
 
$memcache = new Memcache;$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");$sess_id = "d116f2af6b07deaac588c8c34cca919b";$session->first = "john";$session->last  = "smith";$session->session_id  = "$sess_id";$memcache->set($sess_id,$session,false,900);
 
### MEMCACHE RESULT
 
get d116f2af6b07deaac588c8c34cca919bVALUE d116f2af6b07deaac588c8c34cca919b 1 123O:8:"stdClass":3:{s:5:"first";s:4:"john";s:4:"last";s:5:"smith";s:10:"session_id";s:32:"d116f2af6b07deaac588c8c34cca919b";}END
_________________________________________________________________
With Windows Live Hotmail, you can personalize your inbox with your favorite color.
www.windowslive-hotmail.com/learnmore/personalize.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_addcolor_0607
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070622/32ee283c/attachment.html


More information about the memcached mailing list