本文整理汇总了PHP中Zend\Cache\Storage\StorageInterface::clearByPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageInterface::clearByPrefix方法的具体用法?PHP StorageInterface::clearByPrefix怎么用?PHP StorageInterface::clearByPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Cache\Storage\StorageInterface
的用法示例。
在下文中一共展示了StorageInterface::clearByPrefix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testClearByPrefixThrowsInvalidArgumentExceptionOnEmptyPrefix
public function testClearByPrefixThrowsInvalidArgumentExceptionOnEmptyPrefix()
{
if (!$this->_storage instanceof ClearByPrefixInterface) {
$this->markTestSkipped("Storage doesn't implement ClearByPrefixInterface");
}
$this->setExpectedException('Zend\\Cache\\Exception\\InvalidArgumentException');
$this->_storage->clearByPrefix('');
}
示例2: testClearByPrefix
public function testClearByPrefix()
{
if (!$this->_storage instanceof ClearByPrefixInterface) {
$this->markTestSkipped("Storage doesn't implement ClearByPrefixInterface");
}
$this->assertSame(array(), $this->_storage->setItems(array('key1' => 'value1', 'key2' => 'value2', 'test' => 'value')));
$this->assertTrue($this->_storage->clearByPrefix('key'));
$this->assertFalse($this->_storage->hasItem('key1'));
$this->assertFalse($this->_storage->hasItem('key2'));
$this->assertTrue($this->_storage->hasItem('test'));
}