Skip to content

Instantly share code, notes, and snippets.

@payden
payden / thing.php
Created July 15, 2014 15:57
Yet another thing
protected function _set_item_in_memcache($type, $id, $obj) {
$mc_key = "cache_{$type}_{$id}";
$this->cache->set($mc_key, json_encode($obj));
}
protected function _populate_item_from_memcache($type, $id) {
$mc_key = "cache_{$type}_{$id}";
$rv = $this->cache->get($mc_key);
if ($rv === false) return;
$this->_caches[$type][$id] = json_decode($rv, true);