telnet> stats
STAT pid 2136
STAT uptime 1815239
STAT time 1251880772
STAT version 1.2.8
STAT pointer_size 32
STAT rusage_user 1048.295360
STAT rusage_system 2485.224317
STAT curr_items 324467
STAT total_items 842678
STAT bytes 2957363197
STAT curr_connections 19
STAT total_connections 3485926
STAT connection_structures 36091
STAT cmd_flush 6
STAT cmd_get 6041808
STAT cmd_set 842678
STAT get_hits 1913947
STAT get_misses 4127861
STAT evictions 0
STAT bytes_read 9069330247
STAT bytes_written 10650047454
STAT limit_maxbytes 0
STAT threads 5
STAT accepting_conns 1
STAT listen_disabled_num 0
END

Uptime ~ 500 hours

The command "flush" is disabled by our script. The only thing you can
do is delete a key - but nobody instead of me can do this.

Well a snippts :)
Let me explain the script:
We are using smarty an get the HTML-Code (whole site) in a variable
($s_html).
By using the URL we create a unique key (less than 200 characters).
Now we check, if the key is already saved

# $sCacheFile = unique key!
$s_html_cache = $o_memcache->get($sCacheFile);
if($s_html_cache !== false)
  echo $s_html_cache;
else
  $o_memcache->set($sCacheFile,$s_html,60*60*6);

--> 60*60*6 = 6h (also tried 21600, time()+21600)

After the GET and SET (tried "ADD" too) we check the result code by
using
$o_memcache->getResultCode();

The result code returns 0 (success) or 7 (?) or 1 (?) or 16 (by using
GET).

Need more infos?
Thanks for helping!

Jean Michel

Reply via email to