本文整理汇总了PHP中Zend\Cache\StorageFactory::adapterFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageFactory::adapterFactory方法的具体用法?PHP StorageFactory::adapterFactory怎么用?PHP StorageFactory::adapterFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Cache\StorageFactory
的用法示例。
在下文中一共展示了StorageFactory::adapterFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getSSObject
/**
* Enter description here...
*
* @return \Zend\Service\SlideShare\SlideShare
*/
protected function _getSSObject()
{
$ss = new SlideShareService(TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY, TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET, TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME, TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD, TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID);
$cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
$ss->setCacheObject($cache);
return $ss;
}
示例2: setUp
public function setUp()
{
$this->_originaltimezone = date_default_timezone_get();
date_default_timezone_set('Europe/Paris');
$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
DateObjectTestHelper::setOptions(array('cache' => $this->_cache));
}
示例3: testAdapterFactory
public function testAdapterFactory()
{
$adapter1 = Cache\StorageFactory::adapterFactory('Memory');
$this->assertInstanceOf('Zend\\Cache\\Storage\\Adapter\\Memory', $adapter1);
$adapter2 = Cache\StorageFactory::adapterFactory('Memory');
$this->assertInstanceOf('Zend\\Cache\\Storage\\Adapter\\Memory', $adapter2);
$this->assertNotSame($adapter1, $adapter2);
}
示例4: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @return void
*/
public function setUp()
{
$this->clearRegistry();
$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
Currency\Currency::setCache($this->_cache);
$this->helper = new Helper\Currency('de_AT');
}
示例5: __construct
/**
* @param string $apiKey
* @param StorageInterface $cache
*/
public function __construct($apiKey, $service, StorageInterface $cache = null)
{
$this->apiKey = $apiKey;
$this->service = $service;
if ($cache === null) {
$cache = StorageFactory::adapterFactory('memory ', array('ttl' => 600));
}
$this->cache = $cache;
}
示例6: setUp
protected function setUp()
{
$this->select = new Sql\Select();
$this->select->from('test');
$this->testCollection = range(1, 101);
$this->paginator = new Paginator\Paginator(new Paginator\Adapter\ArrayAdapter($this->testCollection));
$this->config = Config\Factory::fromFile(__DIR__ . '/_files/config.xml', true);
$this->cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
Paginator\Paginator::setCache($this->cache);
$this->_restorePaginatorDefaults();
}
示例7: createAdapter
private function createAdapter($name)
{
$name = ucfirst(strtolower($name));
if ($name === self::ENGINE_FILE) {
$name = self::ENGINE_FILESYSTEM;
}
$const = 'PHPPdf\\Cache\\CacheImpl::ENGINE_' . strtoupper($name);
if (!defined($const)) {
throw $this->cacheEngineDosntExistException($name);
}
$name = constant($const);
return StorageFactory::adapterFactory($name);
}
示例8: __construct
public function __construct($game)
{
$this->game = $game;
// $this->mock = new MockHandler([]);
$this->client = new HttpClient();
$adapter = new \Zend\Http\Client\Adapter\Curl();
$adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$this->client->setAdapter($adapter);
// $this->client = new Client([
// 'handler' => HandlerStack::create($this->mock)
//]);
$cache = StorageFactory::adapterFactory('memory ', array('ttl' => 100));
parent::__construct('5nssdkuvwub25ydqzhwwznvzh8hh2ag9', new Region(Region::EUROPE), $cache);
}
示例9: setUp
protected function setUp()
{
if (!extension_loaded('pdo_sqlite')) {
$this->markTestSkipped('Pdo_Sqlite extension is not loaded');
}
$this->_adapter = new \Zend\Db\Adapter\Pdo\Sqlite(array('dbname' => __DIR__ . '/_files/test.sqlite'));
$this->_query = $this->_adapter->select()->from('test');
$this->_testCollection = range(1, 101);
$this->_paginator = Paginator\Paginator::factory($this->_testCollection);
$this->_config = Config\Factory::fromFile(__DIR__ . '/_files/config.xml', true);
$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
$this->_cache->clear(CacheAdapter::MATCH_ALL);
Paginator\Paginator::setCache($this->_cache);
$this->_restorePaginatorDefaults();
}
示例10: setUp
protected function setUp()
{
if (!extension_loaded('pdo_sqlite')) {
$this->markTestSkipped('Pdo_Sqlite extension is not loaded');
}
$this->_adapter = new DbAdapter\Adapter(array('driver' => 'Pdo_Sqlite', 'database' => __DIR__ . '/_files/test.sqlite'));
$this->_query = new Sql\Select();
$this->_query->from('test');
$this->_testCollection = range(1, 101);
$this->_paginator = Paginator\Paginator::factory($this->_testCollection);
$this->_config = Config\Factory::fromFile(__DIR__ . '/_files/config.xml', true);
$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
Paginator\Paginator::setCache($this->_cache);
$this->_restorePaginatorDefaults();
}
示例11: __construct
public function __construct()
{
$this->tmpCacheDir = @tempnam(sys_get_temp_dir(), 'zend_cache_test_');
if (!$this->tmpCacheDir) {
$err = error_get_last();
$this->fail("Can't create temporary cache directory-file: {$err['message']}");
} elseif (!@unlink($this->tmpCacheDir)) {
$err = error_get_last();
$this->fail("Can't remove temporary cache directory-file: {$err['message']}");
} elseif (!@mkdir($this->tmpCacheDir, 0777)) {
$err = error_get_last();
$this->fail("Can't create temporary cache directory: {$err['message']}");
}
$this->storage = StorageFactory::adapterFactory('filesystem', ['cache_dir' => $this->tmpCacheDir]);
parent::__construct();
}
示例12: setUp
public function setUp()
{
$this->_cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
}
示例13: testLoadingFilesIntoCacheAfterwards
public function testLoadingFilesIntoCacheAfterwards()
{
$cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
$this->assertFalse(Adapter\ArrayAdapter::hasCache());
Adapter\ArrayAdapter::setCache($cache);
$this->assertTrue(Adapter\ArrayAdapter::hasCache());
$adapter = new Adapter\ArrayAdapter(__DIR__ . '/_files/translation_en.php', 'en');
$cache = Adapter\ArrayAdapter::getCache();
$this->assertTrue($cache instanceof CacheAdapter);
$adapter->addTranslation(__DIR__ . '/_files/translation_en.php', 'ru', array('reload' => true));
$test = $adapter->getMessages('all');
$this->assertEquals(6, count($test['ru']));
}
示例14: testAdapterFactory
public function testAdapterFactory()
{
$cache = Cache\StorageFactory::adapterFactory('Memory');
$this->assertInstanceOf('Zend\\Cache\\Storage\\Adapter\\Memory', $cache);
}
示例15: setUp
public function setUp()
{
$this->cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
$this->testArray = array('foo' => 'bar', 'bar' => array('foo' => 'bar'));
}