本文整理汇总了PHP中GeneralCache类的典型用法代码示例。如果您正苦于以下问题:PHP GeneralCache类的具体用法?PHP GeneralCache怎么用?PHP GeneralCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GeneralCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Any changes to the model must be re-cached.
* @see RedBeanModel::save()
*/
public function save($runValidation = true, array $attributeNames = null)
{
$saved = parent::save($runValidation, $attributeNames);
if ($saved) {
GeneralCache::cacheEntry('NamedSecurableItem' . $this->name, $this);
}
return $saved;
}
示例2: unserialize
public static function &get($id)
{
if (GeneralCache::find($id)) {
$data =& unserialize(file_get_contents("/tmp/hcache-{$id}"));
return $data;
}
return false;
}
示例3: setAsProcessed
public static function setAsProcessed($tableName, $identifier)
{
$processedTables = static::resolveProcessedTableNames($identifier);
if (!in_array($tableName, $processedTables)) {
$processedTables[] = $tableName;
GeneralCache::cacheEntry($identifier, $processedTables);
}
}
示例4: testCanSetNullValueToCache
public function testCanSetNullValueToCache()
{
//if memcache is off this test will fail because memcache will not cache null values.
if (MEMCACHE_ON) {
GeneralCache::cacheEntry('somethingForTesting', null);
$value = GeneralCache::getEntry('somethingForTesting');
$this->assertNull($value);
}
}
示例5: getReadSubscriptionModelClassNames
/**
* Get all read subscription model class names
* @return array|mixed
*/
public static function getReadSubscriptionModelClassNames()
{
try {
return GeneralCache::getEntry('readPermissionsSubscriptionModelClassNames');
} catch (NotFoundException $e) {
$readPermissionsSubscriptionModelClassNames = self::findReadSubscriptionModelClassNames();
GeneralCache::cacheEntry('readPermissionsSubscriptionModelClassNames', $readPermissionsSubscriptionModelClassNames);
return $readPermissionsSubscriptionModelClassNames;
}
}
示例6: getGlobalSearchScopingModuleNamesAndLabelsDataByUser
/**
* Given a user, return an array of module names and their translated labels, for which the user
* has the right to access and only modules that support the global search.
* @param User $user
* @return array of module names and labels.
*/
public static function getGlobalSearchScopingModuleNamesAndLabelsDataByUser(User $user)
{
assert('$user->id > 0');
try {
return GeneralCache::getEntry(self::getGlobalSearchScopingCacheIdentifier($user));
} catch (NotFoundException $e) {
$moduleNamesAndLabels = self::findGlobalSearchScopingModuleNamesAndLabelsDataByUser($user);
GeneralCache::cacheEntry(self::getGlobalSearchScopingCacheIdentifier($user), $moduleNamesAndLabels);
return $moduleNamesAndLabels;
}
}
示例7: forgetAllCaches
public static function forgetAllCaches()
{
RedBeanModelsCache::forgetAll();
RedBeansCache::forgetAll();
PermissionsCache::forgetAll();
RightsCache::forgetAll();
PoliciesCache::forgetAll();
GeneralCache::forgetAll();
BeanModelCache::forgetAll();
Currency::resetCaches();
//php only cache
}
示例8: loadMessages
/**
* Override of the parent method because of problems with Yii's default cache
* @see CDbMessageSource::loadMessages()
* @param string $category
* @param string $languageCode
* @return array $messages
*/
protected function loadMessages($category, $languageCode)
{
assert('is_string($category)');
assert('is_string($languageCode)');
try {
$messages = GeneralCache::getEntry(self::getMessageSourceCacheIdentifier($category, $languageCode));
} catch (NotFoundException $e) {
$messages = $this->loadMessagesFromDb($category, $languageCode);
GeneralCache::cacheEntry(self::getMessageSourceCacheIdentifier($category, $languageCode), $messages);
}
return $messages;
}
示例9: tearDownAfterClass
public static function tearDownAfterClass()
{
if (RedBeanDatabase::isFrozen()) {
TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
} else {
TestDatabaseUtil::deleteAllTablesExceptLog();
}
RedBeanModel::forgetAll();
RedBeanDatabase::close();
assert('!RedBeanDatabase::isSetup()');
// Not Coding Standard
GeneralCache::forgetAll();
}
示例10: handleImports
/**
* Import all files that need to be included(for lazy loading)
* @param $event
*/
public function handleImports($event)
{
try {
$filesToInclude = GeneralCache::getEntry('filesToIncludeForTests');
} catch (NotFoundException $e) {
$filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules', true);
$filesToIncludeFromFramework = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core', true);
$totalFilesToIncludeFromModules = count($filesToInclude);
foreach ($filesToIncludeFromFramework as $key => $file) {
$filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;
}
GeneralCache::cacheEntry('filesToIncludeForTests', $filesToInclude);
}
foreach ($filesToInclude as $file) {
Yii::import($file);
}
}
示例11: resolveCustomMetadataAndLoad
public static function resolveCustomMetadataAndLoad()
{
$shouldSaveZurmoModuleMetadata = false;
$metadata = ZurmoModule::getMetadata();
//Add Material to Menu if it doesn't exist
if (!in_array('costbook', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'costbook';
$shouldSaveZurmoModuleMetadata = true;
}
if (!in_array('departmentReferences', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'departmentReferences';
$shouldSaveZurmoModuleMetadata = true;
}
if (!in_array('agreements', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'agreements';
$shouldSaveZurmoModuleMetadata = true;
}
if (!in_array('agreementProducts', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'agreementProducts';
$shouldSaveZurmoModuleMetadata = true;
}
if (!in_array('opportunityProducts', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'opportunityProducts';
$shouldSaveZurmoModuleMetadata = true;
}
if (!in_array('categories', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'categories';
$shouldSaveZurmoModuleMetadata = true;
}
if ($shouldSaveZurmoModuleMetadata) {
ZurmoModule::setMetadata($metadata);
GeneralCache::forgetAll();
}
Yii::import('application.extensions.zurmoinc.framework.data.*');
$defaultDataMaker = new AgreementsDefaultDataMaker();
$defaultDataMaker->make();
$defaultDataMaker = new CostbooksDefaultDataMaker();
$defaultDataMaker->make();
$defaultDataMaker = new OpportunitiesDefaultDataMaker();
$defaultDataMaker->make();
}
示例12: resolveCustomMetadataAndLoad
public static function resolveCustomMetadataAndLoad()
{
$shouldSaveZurmoModuleMetadata = false;
$metadata = ZurmoModule::getMetadata();
if (!in_array('animals', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'animals';
$shouldSaveZurmoModuleMetadata = true;
}
if ($shouldSaveZurmoModuleMetadata) {
ZurmoModule::setMetadata($metadata);
GeneralCache::forgetAll();
}
$metadata = Activity::getMetadata();
if (!in_array('Animal', $metadata['Activity']['activityItemsModelClassNames'])) {
$metadata['Activity']['activityItemsModelClassNames'][] = 'Animal';
Activity::setMetadata($metadata);
GeneralCache::forgetAll();
}
Yii::import('application.extensions.zurmoinc.framework.data.*');
Yii::import('application.modules.animals.data.*');
$defaultDataMaker = new AnimalsDefaultDataMaker();
$defaultDataMaker->make();
}
示例13: forgetAll
public static function forgetAll()
{
GeneralCache::forgetAll();
}
示例14: registerUniqueIndexByMemberName
protected static function registerUniqueIndexByMemberName($member, $modelClassName)
{
$indexName = RedBeanModelMemberIndexMetadataAdapter::resolveRandomIndexName($member, true);
$uniqueIndexes = GeneralCache::getEntry(static::CACHE_KEY, array());
$uniqueIndexes[$modelClassName][$indexName] = array('members' => array($member), 'unique' => true);
GeneralCache::cacheEntry(static::CACHE_KEY, $uniqueIndexes);
}
示例15: getServerInfo
/**
* Downloads the l10n info XML file
*
* @return SimpleXMLElement
*/
protected static function getServerInfo()
{
if (self::$l10nInfo && isset(self::$l10nInfo) && self::$l10nInfo->version == '1.1') {
return self::$l10nInfo;
}
$cacheIdentifier = 'l10nServerInfo';
try {
self::$l10nInfo = GeneralCache::getEntry($cacheIdentifier);
} catch (NotFoundException $e) {
$infoFileUrl = self::$serverDomain . '/' . self::$infoXmlPath;
$xml = simplexml_load_file($infoFileUrl);
self::$l10nInfo = json_decode(json_encode($xml));
GeneralCache::cacheEntry($cacheIdentifier, self::$l10nInfo);
}
if (isset(self::$l10nInfo->version) && self::$l10nInfo->version == '1.1') {
return self::$l10nInfo;
}
throw new FailedServiceException();
}