예제 #1
0
 protected function __construct()
 {
     parent::__construct();
     $host = null;
     $port = null;
     $nc_core = nc_Core::get_object();
     $catalogue = $nc_core->catalogue->get_by_host_name($_SERVER['HTTP_HOST']);
     if ($catalogue) {
         $catalogueID = (int) $catalogue['Catalogue_ID'];
         $sql = "SELECT *, UNIX_TIMESTAMP(`Audit_Begin`) AS Audit_Begin " . "FROM `Cache_Settings` " . "WHERE `Catalogue_ID` = {$catalogueID}";
         $settings = $nc_core->db->get_row($sql, ARRAY_A);
         $host = $settings['Memcached_Host'];
         $port = $settings['Memcached_Port'];
     }
     $this->set_server($host, $port);
     // проверка наличия расширения
     if (!class_exists('Memcache')) {
         throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_DOESNT_EXIST);
     }
     $this->memcache = new Memcache();
     // соединение с сервером
     if (!@$this->memcache->connect($this->host, $this->port)) {
         throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_ERROR);
     }
 }
예제 #2
0
 protected function __construct()
 {
     parent::__construct();
     $nc_core = nc_Core::get_object();
     $this->cache_path = isset($nc_core->CACHE_FOLDER) ? $nc_core->CACHE_FOLDER : $nc_core->DOCUMENT_ROOT . "/" . $nc_core->SUB_FOLDER . "netcat_cache/";
 }