<?php
/* procedural API */
/* connect to memcached server */
$memcache_obj = memcache_connect('memcache_host', 11211);
/*
set value of item with key 'var_key'
using 0 as flag value, compression is not used
expire time is 30 seconds
*/
memcache_set($memcache_obj, 'var_key', 'some variable', 0, 30);
echo memcache_get($memcache_obj, 'var_key');
?>