Skip to content
cybaek edited this page Jan 27, 2011 · 6 revisions

Sample Code

Basic Example

$cache = new MemcachedArrayObject(array("127.0.0.1:11211"));
$cache["Key"] = "Value";
echo $cache["Key"];

Specifying the expiration time

$cache = new MemcachedArrayObject(array("127.0.0.1:11211"), 60); // Second.

Error Handling

$cache = new MemcachedArrayObject(array("1.1.1.1:11211")); // Wrong Server!`
try{
    $cache["Key"] = "test...";
}
catch(Exception $e) {
    echo $e->getMessage();
}

Clone this wiki locally