当前位置: 首页>>代码示例>>PHP>>正文


PHP GeneralCache::getEntry方法代码示例

本文整理汇总了PHP中GeneralCache::getEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralCache::getEntry方法的具体用法?PHP GeneralCache::getEntry怎么用?PHP GeneralCache::getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeneralCache的用法示例。


在下文中一共展示了GeneralCache::getEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getByName

 /**
  * Given a name, get the custom field data model.  Attempts to retrieve from cache, if it is not available,
  * will attempt to retrieve from persistent storage, cache the model, and return.
  * @param string $name
  * @return CustomFieldData model
  * @throws NotFoundException
  */
 public static function getByName($name, $shouldCache = true)
 {
     if (isset(self::$cachedModelsByName[$name])) {
         return self::$cachedModelsByName[$name];
     }
     try {
         // not using default value to save cpu cycles on requests that follow the first exception.
         return GeneralCache::getEntry('CustomFieldData' . $name);
     } catch (NotFoundException $e) {
         assert('is_string($name)');
         assert('$name != ""');
         $bean = ZurmoRedBean::findOne('customfielddata', "name = :name ", array(':name' => $name));
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $customFieldData = new CustomFieldData();
             $customFieldData->name = $name;
             $customFieldData->serializedData = serialize(array());
             // An unused custom field data does not present as needing saving.
             $customFieldData->setNotModified();
         } else {
             $customFieldData = self::makeModel($bean);
         }
         if ($shouldCache) {
             self::$cachedModelsByName[$name] = $customFieldData;
             GeneralCache::cacheEntry('CustomFieldData' . $name, $customFieldData);
         }
         return $customFieldData;
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:36,代码来源:CustomFieldData.php

示例2: 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);
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:9,代码来源:GeneralCacheTest.php

示例3: getCacheIncrementValue

 /**
  * Get curent increment value, based on $cacheType. Cache types can be:
  * "G:" - for GlobalCache
  * "M:" - for RedBeanModelsCache
  * "P:" - for PermissionCache
  * We need to distinct those cache types, because we should be able to forget only GlobalCache(increment
  * cache increment value), while other two cache types will contain valid data.
  * @param string $cacheType
  * @return int|mixed
  */
 protected static function getCacheIncrementValue($cacheType)
 {
     try {
         $cacheIncrementValue = GeneralCache::getEntry(static::$cacheIncrementValueVariableName . $cacheType);
     } catch (NotFoundException $e) {
         $cacheIncrementValue = 0;
         static::setCacheIncrementValue($cacheType, $cacheIncrementValue);
     }
     return $cacheIncrementValue;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:ZurmoCache.php

示例4: 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;
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:14,代码来源:ReadPermissionsSubscriptionUtil.php

示例5: 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;
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:17,代码来源:GlobalSearchUtil.php

示例6: resolveByCacheAndGetVisibleAndOrderedAdminTabMenuByUser

 /**
  * @param $user
  * @return array|mixed
  */
 public static function resolveByCacheAndGetVisibleAndOrderedAdminTabMenuByUser($user)
 {
     assert('$user instanceof User && $user != null');
     try {
         $items = GeneralCache::getEntry(self::getAdminMenuViewItemsCacheIdentifier());
     } catch (NotFoundException $e) {
         $items = self::getVisibleAndOrderedAdminTabMenuByUser($user);
         GeneralCache::cacheEntry(self::getAdminMenuViewItemsCacheIdentifier(), $items);
     }
     return $items;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:MenuUtil.php

示例7: 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;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:19,代码来源:ZurmoMessageSource.php

示例8: getMetadata

 /**
  * @return array
  */
 public static function getMetadata()
 {
     $className = get_called_class();
     try {
         return GeneralCache::getEntry($className . 'Metadata');
     } catch (NotFoundException $e) {
     }
     $metadata = MetadataUtil::getMetadata($className);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     return $metadata;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:17,代码来源:ModelToComponentRules.php

示例9: 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);
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:21,代码来源:BeginRequestTestBehavior.php

示例10: getMetadata

 /**
  * Returns metadata for use in automatically generating the view.  Will attempt to retrieve from cache if
  * available, otherwill retrieve from database and cache.
  * @see getDefaultMetadata()
  * @param $user The current user.
  * @returns An array of metadata.
  */
 public static function getMetadata(User $user = null)
 {
     $className = static::resolveMetadataClassNameToUse();
     if ($user == null) {
         try {
             return GeneralCache::getEntry($className . 'Metadata');
         } catch (NotFoundException $e) {
         }
     }
     $metadata = MetadataUtil::getMetadata($className, $user);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     if ($user == null) {
         GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     }
     return $metadata;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:ConfigurableMetadataView.php

示例11: getByName

 /**
  * Given a name, check the cache if the model is cached and return. Otherwise check the database for the record,
  * cache and return this model.
  * @param string $name
  */
 public static function getByName($name)
 {
     assert('is_string($name)');
     assert('$name != ""');
     try {
         return GeneralCache::getEntry('NamedSecurableItem' . $name);
     } catch (NotFoundException $e) {
         $bean = R::findOne('namedsecurableitem', "name = :name ", array(':name' => $name));
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $model = new NamedSecurableItem();
             $model->unrestrictedSet('name', $name);
         } else {
             $model = self::makeModel($bean);
         }
     }
     GeneralCache::cacheEntry('NamedSecurableItem' . $name, $model);
     return $model;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:24,代码来源:NamedSecurableItem.php

示例12: getByName

 /**
  * Given a name, check the cache if the model is cached and return. Otherwise check the database for the record,
  * cache and return this model.
  * @param string $name
  */
 public static function getByName($name)
 {
     assert('is_string($name)');
     assert('$name != ""');
     try {
         // not using default value to save cpu cycles on requests that follow the first exception.
         return GeneralCache::getEntry('NamedSecurableItem' . $name);
     } catch (NotFoundException $e) {
         $bean = ZurmoRedBean::findOne('namedsecurableitem', "name = :name ", array(':name' => $name));
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $model = new NamedSecurableItem();
             $model->unrestrictedSet('name', $name);
         } else {
             $model = self::makeModel($bean);
         }
     }
     GeneralCache::cacheEntry('NamedSecurableItem' . $name, $model);
     return $model;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:25,代码来源:NamedSecurableItem.php

示例13: getNonMonitorJobClassNames

 public static function getNonMonitorJobClassNames()
 {
     try {
         $jobClassNames = GeneralCache::getEntry(self::NON_MONITOR_JOBS_CACHE_ID);
     } catch (NotFoundException $e) {
         $jobClassNames = array();
         $modules = Module::getModuleObjects();
         foreach ($modules as $module) {
             $jobsClassNames = $module::getAllClassNamesByPathFolder('jobs');
             foreach ($jobsClassNames as $jobClassName) {
                 $classToEvaluate = new ReflectionClass($jobClassName);
                 if (is_subclass_of($jobClassName, 'BaseJob') && !$classToEvaluate->isAbstract() && $jobClassName != 'MonitorJob') {
                     $jobClassNames[] = $jobClassName;
                 }
             }
         }
         GeneralCache::cacheEntry(self::NON_MONITOR_JOBS_CACHE_ID, $jobClassNames);
     }
     return $jobClassNames;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:20,代码来源:JobsToJobsCollectionViewUtil.php

示例14: getByName

 /**
  * Given a name, get the custom field data model.  Attempts to retrieve from cache, if it is not available,
  * will attempt to retrieve from persistent storage, cache the model, and return.
  * @param string $name
  */
 public static function getByName($name)
 {
     try {
         return GeneralCache::getEntry('CustomFieldData' . $name);
     } catch (NotFoundException $e) {
         assert('is_string($name)');
         assert('$name != ""');
         $bean = R::findOne('customfielddata', "name = '{$name}'");
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $customFieldData = new CustomFieldData();
             $customFieldData->name = $name;
             $customFieldData->serializedData = serialize(array());
             // An unused custom field data does not present as needing saving.
             $customFieldData->setNotModified();
             return $customFieldData;
         }
         $model = self::makeModel($bean);
         GeneralCache::cacheEntry('CustomFieldData' . $name, $model);
         return $model;
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:27,代码来源:CustomFieldData.php

示例15: getEntry

 public static function getEntry($identifier, $default = 'NOT_FOUND_EXCEPTION', $cacheDefaultValue = false)
 {
     try {
         return parent::getEntry($identifier, $default, $cacheDefaultValue);
     } catch (NotFoundException $e) {
         if (static::supportsAndAllowsDatabaseCaching()) {
             $row = ZurmoRedBean::getRow("select entry from actual_rights_cache " . "where identifier = '" . $identifier . "'");
             if ($row != null && isset($row['entry'])) {
                 //Calling parent because we don't need to re-cache the db cache item
                 parent::cacheEntry($identifier, $row['entry']);
                 return $row['entry'];
             }
         }
         if ($default === 'NOT_FOUND_EXCEPTION') {
             throw new NotFoundException();
         } else {
             if ($cacheDefaultValue) {
                 static::cacheEntry($identifier, $default);
             }
             return $default;
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:23,代码来源:RightsCache.php


注:本文中的GeneralCache::getEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。