コード例 #1
0
 /**
  * @param int $item_id
  * @param int|null $node_id - укаывается для кеширования.
  *
  * @return mixed|\SmartCore\Module\Texter\Entity\Item
  */
 public function get($item_id, $node_id = null)
 {
     $cache_key = 'smart_module.texter' . $item_id;
     if (false == ($item = $this->cache->get($cache_key))) {
         $item = $this->em->find('TexterModule:Item', $item_id);
         if ($node_id) {
             $this->cache->set($cache_key, $item, ['smart_module.texter', 'node_' . $node_id]);
         }
     }
     return $item;
 }
コード例 #2
0
ファイル: Memcache.php プロジェクト: rickysu/tagcache
 public function __construct($NameSpace, $Options)
 {
     parent::__construct($NameSpace, $Options);
     $this->Memcache = new \Memcache();
     foreach ($Options['servers'] as $Server) {
         list($Host, $Port, $Weight) = explode(":", $Server);
         $this->Memcache->addServer($Host, $Port, true, $Weight);
     }
 }
コード例 #3
0
ファイル: Apc.php プロジェクト: rickysu/tagcache
 public function __construct($NameSpace, $Options)
 {
     parent::__construct($NameSpace, $Options);
 }
コード例 #4
0
ファイル: Sqlite.php プロジェクト: rickysu/tagcache
 public function __construct($NameSpace, $Options)
 {
     parent::__construct($NameSpace, $Options);
     $this->InitDBFile();
 }
コード例 #5
0
ファイル: File.php プロジェクト: rickysu/tagcache
 public function __construct($NameSpace, $Options)
 {
     parent::__construct($NameSpace, $Options);
     $this->CacheBaseDir = $Options['cache_dir'];
 }