本文整理汇总了PHP中Zend\Cache\Storage\Adapter\AbstractAdapter::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractAdapter::getItems方法的具体用法?PHP AbstractAdapter::getItems怎么用?PHP AbstractAdapter::getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Cache\Storage\Adapter\AbstractAdapter
的用法示例。
在下文中一共展示了AbstractAdapter::getItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInternalGetItemsCallsInternalGetItemForEachKey
public function testInternalGetItemsCallsInternalGetItemForEachKey()
{
$this->markTestSkipped("This test doesn't work because of an issue with PHPUnit: " . 'https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81');
$this->_storage = $this->getMockForAbstractAdapter(array('internalGetItem'));
$items = array('key1' => 'value1', 'notFound' => false, 'key2' => 'value2');
$result = array('key1' => 'value1', 'key2' => 'value2');
$i = 0;
// method call counter
foreach ($items as $k => $v) {
$this->_storage->expects($this->at($i++))->method('internalGetItem')->with($this->equalTo($k), $this->equalTo(null), $this->equalTo(null))->will($this->returnCallback(function ($k, &$success, &$casToken) use($items) {
if ($items[$k]) {
$success = true;
return $items[$k];
} else {
$success = false;
return null;
}
}));
}
$rs = $this->_storage->getItems(array_keys($items), $options);
$this->assertEquals($result, $rs);
}
示例2: getItems
/**
* Get multiple items.
*
* @param array $keys
* @return array Associative array of keys and values
* @throws Exception\ExceptionInterface
*
* @triggers getItems.pre(PreEvent)
* @triggers getItems.post(PostEvent)
* @triggers getItems.exception(ExceptionEvent)
*/
public function getItems(array $keys)
{
$options = $this->getOptions();
if ($options->getReadable() && $options->getClearStatCache()) {
clearstatcache();
}
return parent::getItems($keys);
}