Solution for writing a function layer between pecl-memcache and PHP

Sascha Braun - CEO at Braun Networks sascha at braun-networks.com
Sat Jul 28 06:52:39 UTC 2007


Dear Mister Minka,

in the attachment of this file, you will find a complete example for
the problem, decscribed.

There are two working examples, and the main example which is not
working.

Could you please be so kind in between to tell me who you are, because
I couldn't find any mails in the php general list or in the memcache
list which have been written from your mail account.

If your are able to correct the error, please send me a patched version.

Thank you very much.

Best Regards,

Sascha Braun

Am Samstag, den 28.07.2007, 01:53 +0200 schrieb Martin Minka:
> Sascha,
> konntest du ein test PHP Script schicken dass dieses Problem wiederholt ?
> 
> Meine erste Vermutung ist dass du irgendwo in deinem Kode Fehler hast. 
> Wenn du es aber in einen beispiel Script wiederholen kannst werde ich es 
> in C Compiler testen.
> Ich habe nämlich inzwischen die Compilierung von PECL-memcache Kode an 
> meinem PC eingeästelt um mein Problem mit "redundancy" zu lösen.
> 
> Mit grüssen,
> Martin Minka
> 
> 
> Sascha Braun - CEO @ Braun Networks wrote:
> > Hi dear Sancar,
> > 
> > you seem really the best man in place as what I see in the mailing
> > list :)) Thats really lovely I would like to say.
> > 
> > Now lets come to the solution I need:
> > 
> > public function memcache($pointer, $data="", $compress="", $timeout="0")
> > // store or load data from the memcache
> > {
> > if (MEMCACHE_SUPPORT == 'true') {
> > $memcached_port = $_SESSION['memcache_port'];
> > if (empty($memcached_port)) { $memcached_port = '99999'; }
> > $memcache = memcache_connect('localhost', $memcached_port);
> > if ($memcache) {
> > $memcache_pointer = PROJECT.$pointer;
> > $cache = $memcache -> get($memcache_pointer);
> > if (!$cache) {
> > $memcache->set($memcache_pointer,$data);
> > $cache = $memcache -> get($memcache_pointer);
> > }
> > return $cache;
> > }
> > }
> > }
> > 
> > This is the Funktion I use to load and write data to the memcache
> > a write or restore looks like this here site::memcache('pointer',$data);
> > 
> > This is working in many cases pretty fine.
> > 
> > Now I have a codepart, where the 'pointer' is getting created dynamical-
> > ly. Which means I do fx. a $content_id.'_'.$translation instead of wri-
> > ting a simple 'pointer' as first parameter to the above function.
> > 
> > When I now call my XML Parser, to store data in memcache, and try to
> > recall, the data short after, it says:
> > 
> > File not found: This file somewhere in the suburbs.
> > 
> > But when I try to output the XML Object before the data is written to
> > the cache, everything goes terribly fine.
> > 
> > Now I figured out, that when I use static naming for the memcache data
> > pointer 'pointer' everything goes fine.
> > 
> > When I use the memcache directly, which means, I call the
> > $memcache->set() and $memcache->get() function from where I store data
> > everything goes fine again, even with dynamically created, variables.
> > 
> > But as soon as I use my function layer, call a to
> > site::memcache($pointername,$dataset); only  returnes bullshit.
> > 
> > Mh, this makes me a little bit sad.
> > 
> > Maybe somebody or even you, can help me :))
> > 
> > Best Regards, and a baba Respect from Germany, Dear Sancar!
> > 
> > Sascha
> > 
> > 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memcached-test.tar.gz
Type: application/x-compressed-tar
Size: 3206 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070728/55bf04ae/memcached-test.tar.bin


More information about the memcached mailing list