Last 5.3 release ever available: PHP 5.3.29 - 5.3 now EOL

Examples

Table of Contents

add a note add a note

User Contributed Notes 2 notes

up
0
Anonymous
16 hours ago
<?php

$memcache
= memcache_connect('localhost', 11211);

if (
$memcache) {
   
$memcache->set("str_key", "String to store in memcached");
   
$memcache->set("num_key", 123);

   
$object = new StdClass;
   
$object->attribute = 'test';
   
$memcache->set("obj_key", $object);

   
$array = Array('assoc'=>123, 345, 567);
   
$memcache->set("arr_key", $array);

   
var_dump($memcache->get('str_key'));
   
var_dump($memcache->get('num_key'));
   
var_dump($memcache->get('obj_key'));
}
else {
    echo
"Connection to memcached failed";
}
?>
up
-2
swapniltiwhane at gmail dot com
2 months ago
$memcache = new Memcache;  //initialised memcahe
@$memcache->connect("127.0.0.1",11211);  // connect memcahe server
$cache = getCache(md5("mysql_query" . $sql));
//get sql query if already cached in memcahe
To Top