本文整理汇总了PHP中ObjectCache::newFromId方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectCache::newFromId方法的具体用法?PHP ObjectCache::newFromId怎么用?PHP ObjectCache::newFromId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectCache
的用法示例。
在下文中一共展示了ObjectCache::newFromId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMakeKey
/**
* @covers BagOStuff::makeGlobalKey
* @covers BagOStuff::makeKeyInternal
*/
public function testMakeKey()
{
$cache = ObjectCache::newFromId('hash');
$localKey = $cache->makeKey('first', 'second', 'third');
$globalKey = $cache->makeGlobalKey('first', 'second', 'third');
$this->assertStringMatchesFormat('%Sfirst%Ssecond%Sthird%S', $localKey, 'Local key interpolates parameters');
$this->assertStringMatchesFormat('global%Sfirst%Ssecond%Sthird%S', $globalKey, 'Global key interpolates parameters and contains global prefix');
$this->assertNotEquals($localKey, $globalKey, 'Local key and global key with same parameters should not be equal');
}
示例2: setUp
protected function setUp()
{
parent::setUp();
// type defined through parameter
if ($this->getCliArg('use-bagostuff')) {
$name = $this->getCliArg('use-bagostuff');
$this->cache = ObjectCache::newFromId($name);
} else {
// no type defined - use simple hash
$this->cache = new HashBagOStuff();
}
$this->cache->delete(wfMemcKey('test'));
}