Tag Archives: cache

memcache sample code

簡單版的測試 sample code

[code language=’php’]

// filename : memcache.php

$memcache = new Memcache;
$memcache->addServer('172.20.50.25', 11211);

// set 一個值到 memcache

$memcache->set('key', time() , MEMCACHE_COMPRESSED, 120);

// get 值

$data=$memcache->get('key');
print_r($data);