本文整理汇总了PHP中GeneralCache::forgetEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralCache::forgetEntry方法的具体用法?PHP GeneralCache::forgetEntry怎么用?PHP GeneralCache::forgetEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeneralCache
的用法示例。
在下文中一共展示了GeneralCache::forgetEntry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testForgetEntry
/**
* @depends testCanSetValueToCache
*/
public function testForgetEntry()
{
if (MEMCACHE_ON) {
GeneralCache::cacheEntry('somethingForTesting3', 10);
$value = GeneralCache::getEntry('somethingForTesting3');
$this->assertEquals(10, $value);
GeneralCache::forgetEntry('somethingForTesting3');
try {
GeneralCache::getEntry('somethingForTesting3');
$this->fail('NotFoundException exception is not thrown.');
} catch (NotFoundException $e) {
$this->assertTrue(true);
}
}
}
示例2: unrestrictedDelete
protected function unrestrictedDelete()
{
unset(self::$cachedModelsByName[$this->name]);
GeneralCache::forgetEntry('CustomFieldData' . $this->name);
return parent::unrestrictedDelete();
}
示例3: setMetadata
/**
* Sets metadata for the model.
* @see getDefaultMetadata()
* @returns An array of metadata.
*/
public static function setMetadata(array $metadata)
{
if (YII_DEBUG) {
self::assertMetadataIsValid($metadata);
}
$className = get_called_class();
foreach (array_reverse(RuntimeUtil::getClassHierarchy($className, static::$lastClassInBeanHeirarchy)) as $modelClassName) {
if ($modelClassName::getCanHaveBean()) {
if ($modelClassName::canSaveMetadata()) {
if (isset($metadata[$modelClassName])) {
try {
$globalMetadata = GlobalMetadata::getByClassName($modelClassName);
} catch (NotFoundException $e) {
$globalMetadata = new GlobalMetadata();
$globalMetadata->className = $modelClassName;
}
$globalMetadata->serializedMetadata = serialize($metadata[$modelClassName]);
$saved = $globalMetadata->save();
// TODO: decide how to deal with this properly if it fails.
// ie: throw or return false, or something other than
// this naughty assert.
assert('$saved');
}
}
}
}
self::forgetBeanModel(get_called_class());
RedBeanModelsCache::forgetAllByModelType(get_called_class());
GeneralCache::forgetEntry(get_called_class() . 'Metadata');
}
示例4: forgetCacheEntryForTabMenuByUser
/**
* @param $user
*/
public static function forgetCacheEntryForTabMenuByUser($user)
{
$identifier = self::getMenuViewItemsCacheIdentifierByUser($user);
GeneralCache::forgetEntry($identifier);
}
示例5: clearCache
public static function clearCache($category, $languageCode)
{
assert('is_string($category)');
assert('is_string($languageCode)');
GeneralCache::forgetEntry(self::getMessageSourceCacheIdentifier($category, $languageCode));
}
示例6: setMetadata
/**
* Sets new metadata.
* @param $metadata An array of metadata.
* @param $user The current user.
*/
public static function setMetadata(array $metadata, User $user = null)
{
$className = get_called_class();
if (YII_DEBUG) {
self::assertMetadataIsValid($metadata);
}
MetadataUtil::setMetadata($className, $metadata, $user);
if ($user == null) {
GeneralCache::forgetEntry($className . 'Metadata');
}
}
示例7: handleImports
/**
* Import all files that need to be included(for lazy loading)
* @param $event
*/
public function handleImports($event)
{
//Clears file cache so that everything is clean.
if (isset($_GET['clearCache']) && $_GET['clearCache'] == 1) {
GeneralCache::forgetEntry('filesClassMap');
}
try {
// not using default value to save cpu cycles on requests that follow the first exception.
Yii::$classMap = GeneralCache::getEntry('filesClassMap');
} catch (NotFoundException $e) {
$filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules');
$filesToIncludeFromCore = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core');
$totalFilesToIncludeFromModules = count($filesToInclude);
foreach ($filesToIncludeFromCore as $key => $file) {
$filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;
}
foreach ($filesToInclude as $file) {
Yii::import($file);
}
GeneralCache::cacheEntry('filesClassMap', Yii::$classMap);
}
Yii::app()->setAllClassesAreImported();
}
示例8: setMetadata
public static function setMetadata(array $metadata)
{
if (YII_DEBUG) {
self::assertMetadataIsValid($metadata);
}
// Save the mixed in Person metadata.
if (isset($metadata['Person'])) {
$modelClassName = 'Person';
try {
$globalMetadata = GlobalMetadata::getByClassName($modelClassName);
} catch (NotFoundException $e) {
$globalMetadata = new GlobalMetadata();
$globalMetadata->className = $modelClassName;
}
$globalMetadata->serializedMetadata = serialize($metadata[$modelClassName]);
$saved = $globalMetadata->save();
assert('$saved');
}
if (isset($metadata['User'])) {
parent::setMetadata($metadata);
}
GeneralCache::forgetEntry(get_called_class() . 'Metadata');
}
示例9: flushModuleLabelTranslationParameters
/**
* Used by tests to reset value between tests.
*/
public function flushModuleLabelTranslationParameters()
{
foreach (Yii::app()->params['supportedLanguages'] as $language => $notUsed) {
GeneralCache::forgetEntry('moduleLabelTranslationParameters' . $language);
}
}