<?php
// ArrayCache only lives per request and is good for testing
use Doctrine\Common\Cache\ArrayCache;
// you can use APC, Memcache, XCache...
$cache = new ArrayCache();
$value = 'I\'m worthy to be cached';
$key = sha1($value);
$cache->save($key, $value);
if ($cache->contains($key)) {
echo $cache->fetch($key);
}