Пример #1
0
<?php

/**
 * Yaf.app Framework
 *
 * Import.php
 *
 * 演示模块配置文件
 *
 * @author xudianyang<*****@*****.**>
 * @copyright Copyright (c) 2014 (http://www.phpboy.net)
 * @package Demo
 */
namespace Demo;

use Cache\CachePool;
return array('redis' => function () {
    $storage = CachePool::factory(array('storage' => 'redis', 'namespace' => 'demo:'));
    CachePool::register($storage);
    CachePool::get()->setResource(array('host' => '127.0.0.1', 'port' => 6379));
    CachePool::get()->getResource();
    return CachePool::get();
});
Пример #2
0
 /**
  * Constructor
  *
  * @param AdapterInterface $adapter
  */
 public function __construct(AdapterInterface $adapter)
 {
     $this->adapter = $adapter;
     $this->cacher = CachePool::get('MetadataCacher');
     $this->defaultSchema = $adapter->getDriver()->getConnection()->getCurrentSchema() ?: self::DEFAULT_SCHEMA;
 }