/** * store object in cache * @global object $memcache * @global int $lastModified represents the last modified date * @param string [$key] key for data to store * @param mixed [$var] variable with data to store * @return boolean true if success, false otherwise * @uses MEMCACHED_PORT */ function setCachedData($key, $var) { global $memcache, $lastModified; if (!$memcache) { $memcache = new Memcache(); if (!$memcache->connect('localhost', MEMCACHED_PORT)) { //saw Decision: error or just load raw??? error_log("couldn't connect to memcached - not caching DB queries"); } } setLastModified(); $memcache->set('lastUpdate:' . $key, $lastModified); return $memcache->set($key, $var); }
/** * store object in cache * @global object $memcache * @global int $lastModified represents the last modified date * @param string [$key] key for data to store * @param mixed [$var] variable with data to store * @return boolean true if success, false otherwise * @uses MEMCACHED_PORT */ function setCachedData($key, $var) { global $memcache, $lastModified; setLastModified(); try { @$memcache->set('lastUpdate:' . $key, $lastModified); return $memcache->set($key, $var); } catch (Exception $e) { } }