Esempio n. 1
0
 public static function init()
 {
     if (!self::$server && !self::$server) {
         // die, change to clean handling later
         //die('cache not configured');
     }
     try {
         self::$memc = new \Memcached();
         self::$memc->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
         self::$memc->addServer(self::$server, self::$port);
     } catch (Exception $e) {
         Errors::handle($e);
     }
 }
Esempio n. 2
0
 public function runQuery($sql, $params = null)
 {
     $db = self::getDB();
     if (empty($db)) {
         die('There has been a serious problem');
     }
     $stmt = $db->prepare($sql);
     //Debugger::debug($sql, 'Running SQL');
     try {
         $stmt->execute($params);
     } catch (PDOException $e) {
         Errors::handle($e, 'sqlerr');
     }
     return $stmt;
 }