當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tinebase_Core::getCache方法代碼示例

本文整理匯總了PHP中Tinebase_Core::getCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tinebase_Core::getCache方法的具體用法?PHP Tinebase_Core::getCache怎麽用?PHP Tinebase_Core::getCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tinebase_Core的用法示例。


在下文中一共展示了Tinebase_Core::getCache方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testUninstallApplications

 /**
  * test uninstall application and cache clearing
  *
  */
 public function testUninstallApplications()
 {
     $cache = Tinebase_Core::getCache();
     $cacheId = 'unittestcache';
     $cache->save('something', $cacheId);
     try {
         $result = $this->_uit->uninstallApplications(array('ActiveSync'));
     } catch (Tinebase_Exception_NotFound $e) {
         $this->_uit->installApplications(array('ActiveSync'));
         $result = $this->_uit->uninstallApplications(array('ActiveSync'));
     }
     $this->assertFalse($cache->test($cacheId), 'cache is not cleared');
     $apps = $this->_uit->searchApplications();
     // get active sync
     foreach ($apps['results'] as $app) {
         if ($app['name'] == 'ActiveSync') {
             $activeSyncApp = $app;
             break;
         }
     }
     // checks
     $this->assertTrue(isset($activeSyncApp));
     $this->assertEquals('uninstalled', $activeSyncApp['install_status']);
     // cleanup
     $this->_uit->installApplications(array('ActiveSync'));
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:30,代碼來源:ControllerTest.php

示例2: findTimesheetsForReport

 /**
  * calls Timetracker_Controller_Timesheet::findTimesheetsByTimeaccountAndPeriod arguments suitable for async job
  * returns true if cache could be saved.
  * 
  * @param array $args
  * @return boolean
  */
 public function findTimesheetsForReport(array $args)
 {
     $cache = Tinebase_Core::getCache();
     $results = Timetracker_Controller_Timesheet::getInstance()->findTimesheetsByTimeaccountAndPeriod($args['timeaccountId'], $args['startDate'], $args['endDate'], $args['destination'], $args['taCostCenter']);
     $m = str_replace('-', '', $args['month']);
     return $cache->save(array('results' => $results), $args['cacheId'], array($args['cacheId'] . '_' . $m));
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:14,代碼來源:Controller.php

示例3: testCleanupCache

 /**
  * testCleanupCache
  */
 public function testCleanupCache()
 {
     $this->_instance->cleanupCache(Zend_Cache::CLEANING_MODE_ALL);
     $cache = Tinebase_Core::getCache();
     $oldLifetime = $cache->getOption('lifetime');
     $cache->setLifetime(1);
     $cacheId = Tinebase_Helper::convertCacheId('testCleanupCache');
     $cache->save('value', $cacheId);
     sleep(3);
     // cleanup with CLEANING_MODE_OLD
     $this->_instance->cleanupCache();
     $cache->setLifetime($oldLifetime);
     $this->assertFalse($cache->load($cacheId));
     // check for cache files
     $config = Tinebase_Core::getConfig();
     if ($config->caching && $config->caching->backend == 'File' && $config->caching->path) {
         $cacheFile = $this->_lookForCacheFile($config->caching->path);
         $this->assertEquals(NULL, $cacheFile, 'found cache file: ' . $cacheFile);
     }
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:23,代碼來源:ControllerTest.php

示例4: checkRight

 /**
  * generic check admin rights function
  * rules: 
  * - ADMIN right includes all other rights
  * - MANAGE_* right includes VIEW_* right 
  * - results are cached if caching is active (with cache tag 'rights')
  * 
  * @param   string  $_right to check
  * @param   boolean $_throwException [optional]
  * @param   boolean $_includeTinebaseAdmin [optional]
  * @return  boolean
  * @throws  Tinebase_Exception_UnexpectedValue
  * @throws  Tinebase_Exception_AccessDenied
  * @throws  Tinebase_Exception
  * 
  * @todo move that to *_Acl_Rights
  * @todo include Tinebase admin? atm only the application admin right is checked
  * @todo think about moving the caching to Tinebase_Acl_Roles and use only a class cache as it is difficult (and slow?) to invalidate
  */
 public function checkRight($_right, $_throwException = TRUE, $_includeTinebaseAdmin = TRUE)
 {
     if (empty($this->_applicationName)) {
         throw new Tinebase_Exception_UnexpectedValue('No application name defined!');
     }
     if (!is_object(Tinebase_Core::getUser())) {
         throw new Tinebase_Exception('No user found for right check!');
     }
     $right = strtoupper($_right);
     $cache = Tinebase_Core::getCache();
     $cacheId = Tinebase_Helper::convertCacheId('checkRight' . Tinebase_Core::getUser()->getId() . $right . $this->_applicationName);
     $result = $cache->load($cacheId);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $cacheId);
     }
     if (!$result) {
         $applicationRightsClass = $this->_applicationName . '_Acl_Rights';
         // array with the rights that should be checked, ADMIN is in it per default
         $rightsToCheck = $_includeTinebaseAdmin ? array(Tinebase_Acl_Rights::ADMIN) : array();
         if (preg_match("/VIEW_([A-Z_]*)/", $right, $matches)) {
             // manage right includes view right
             $rightsToCheck[] = constant($applicationRightsClass . '::MANAGE_' . $matches[1]);
         }
         $rightsToCheck[] = constant($applicationRightsClass . '::' . $right);
         $result = FALSE;
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Checking rights: ' . print_r($rightsToCheck, TRUE));
         }
         foreach ($rightsToCheck as $rightToCheck) {
             if (Tinebase_Acl_Roles::getInstance()->hasRight($this->_applicationName, Tinebase_Core::getUser()->getId(), $rightToCheck)) {
                 $result = TRUE;
                 break;
             }
         }
         $cache->save($result, $cacheId, array('rights'), 120);
     }
     if (!$result && $_throwException) {
         throw new Tinebase_Exception_AccessDenied("You are not allowed to {$right} in application {$this->_applicationName} !");
     }
     return $result;
 }
開發者ID:hernot,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:60,代碼來源:Abstract.php

示例5: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     parent::setUp();
     // create shared folder and other users folder
     $this->sharedContainer = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => __CLASS__ . Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_SHARED, 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(), 'backend' => 'Sql')));
     $sclever = Tinebase_Helper::array_value('sclever', Zend_Registry::get('personas'));
     $this->otherUsersContainer = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => __CLASS__ . Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => $sclever->getId(), 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(), 'backend' => 'Sql')));
     Tinebase_Container::getInstance()->addGrants($this->otherUsersContainer, Tinebase_Acl_Rights::ACCOUNT_TYPE_USER, Tinebase_Core::getUser(), array(Tinebase_Model_Grants::GRANT_READ, Tinebase_Model_Grants::GRANT_SYNC), true);
     // clear container caches (brute force)
     Tinebase_Core::getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);
     $this->server = new Sabre\DAV\Server(new Tinebase_WebDav_Root());
     $this->server->debugExceptions = true;
     $this->server->addPlugin(new \Sabre\CalDAV\Plugin());
     $this->server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
     $aclPlugin = new \Sabre\DAVACL\Plugin();
     $aclPlugin->defaultUsernamePath = Tinebase_WebDav_PrincipalBackend::PREFIX_USERS;
     $aclPlugin->principalCollectionSet = array(Tinebase_WebDav_PrincipalBackend::PREFIX_USERS, Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS);
     $this->server->addPlugin($aclPlugin);
     $this->response = new Sabre\HTTP\ResponseMock();
     $this->server->httpResponse = $this->response;
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:27,代碼來源:ProxyTest.php

示例6: updateApplication

 /**
  * update installed application
  *
  * @param   Tinebase_Model_Application    $_application
  * @param   string    $_majorVersion
  * @return  array   messages
  * @throws  Setup_Exception if current app version is too high
  */
 public function updateApplication(Tinebase_Model_Application $_application, $_majorVersion)
 {
     $setupXml = $this->getSetupXml($_application->name);
     $messages = array();
     switch (version_compare($_application->version, $setupXml->version)) {
         case -1:
             $message = "Executing updates for " . $_application->name . " (starting at " . $_application->version . ")";
             $messages[] = $message;
             Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' ' . $message);
             $version = $_application->getMajorAndMinorVersion();
             $minor = $version['minor'];
             $className = ucfirst($_application->name) . '_Setup_Update_Release' . $_majorVersion;
             if (!class_exists($className)) {
                 $nextMajorRelease = $_majorVersion + 1 . ".0";
                 Setup_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " Update class {$className} does not exists, skipping release {$_majorVersion} for app " . "{$_application->name} and increasing version to {$nextMajorRelease}");
                 $_application->version = $nextMajorRelease;
                 Tinebase_Application::getInstance()->updateApplication($_application);
             } else {
                 $update = new $className($this->_backend);
                 $classMethods = get_class_methods($update);
                 // we must do at least one update
                 do {
                     $functionName = 'update_' . $minor;
                     try {
                         $db = Setup_Core::getDb();
                         $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($db);
                         Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updating ' . $_application->name . ' - ' . $functionName);
                         $update->{$functionName}();
                         Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
                     } catch (Exception $e) {
                         Tinebase_TransactionManager::getInstance()->rollBack();
                         Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e->getMessage());
                         Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e->getTraceAsString());
                         throw $e;
                     }
                     $minor++;
                 } while (array_search('update_' . $minor, $classMethods) !== false);
             }
             $messages[] = "<strong> Updated " . $_application->name . " successfully to " . $_majorVersion . '.' . $minor . "</strong>";
             // update app version
             $updatedApp = Tinebase_Application::getInstance()->getApplicationById($_application->getId());
             $_application->version = $updatedApp->version;
             Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updated ' . $_application->name . " successfully to " . $_application->version);
             $this->_updatedApplications++;
             break;
         case 0:
             Setup_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' No update needed for ' . $_application->name);
             break;
         case 1:
             throw new Setup_Exception('Current application version is higher than version from setup.xml: ' . $_application->version . ' > ' . $setupXml->version);
             break;
     }
     Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Clearing cache after update ...');
     $this->_enableCaching();
     Tinebase_Core::getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);
     return $messages;
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:65,代碼來源:Controller.php

示例7: _beforeUpdateStandardAccount

 /**
  * inspect update of normal user account
  * 
  * @param   Tinebase_Record_Interface $_record      the update record
  * @param   Tinebase_Record_Interface $_oldRecord   the current persistent record
  * @return  void
  */
 protected function _beforeUpdateStandardAccount($_record, $_oldRecord)
 {
     $this->_beforeUpdateStandardAccountCredentials($_record, $_oldRecord);
     $diff = $_record->diff($_oldRecord);
     // delete message body cache because display format has changed
     if (array_key_exists('display_format', $diff)) {
         Tinebase_Core::getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('getMessageBody'));
     }
     // reset capabilities if imap host / port changed
     if (isset($_SESSION[$this->_applicationName]) && (array_key_exists('host', $diff) || array_key_exists('port', $diff))) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Resetting capabilities for account ' . $_record->name);
         }
         unset($_SESSION[$this->_applicationName][$_record->getId()]);
     }
 }
開發者ID:rodrigofns,項目名稱:ExpressoLivre3,代碼行數:23,代碼來源:Account.php

示例8: _clearCache

 /**
  * invalidate cache by type/id
  * 
  * @param array $cacheIds
  */
 protected function _clearCache($cacheIds = array())
 {
     $cache = Tinebase_Core::getCache();
     foreach ($cacheIds as $type => $id) {
         $cacheId = Tinebase_Helper::convertCacheId($type . $id);
         $cache->remove($cacheId);
     }
     $this->resetClassCache();
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:14,代碼來源:Sql.php

示例9: _saveMessageInTinebaseCache

 /**
  * save message in tinebase cache
  * - only cache message headers if received during the last day
  * 
  * @param Felamimail_Model_Message $_message
  * @param Felamimail_Model_Folder $_folder
  * @param array $_messageData
  * 
  * @todo do we need the headers in the Tinebase cache?
  */
 protected function _saveMessageInTinebaseCache(Felamimail_Model_Message $_message, Felamimail_Model_Folder $_folder, $_messageData)
 {
     if (!$_message->received->isLater(Tinebase_DateTime::now()->subDay(3))) {
         return;
     }
     $memory = function_exists('memory_get_peak_usage') ? memory_get_peak_usage(true) : memory_get_usage(true);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' caching message ' . $_message->getId() . ' / memory usage: ' . $memory / 1024 / 1024 . ' MBytes');
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_message->toArray(), TRUE));
     }
     $cacheId = 'getMessageHeaders' . $_message->getId();
     Tinebase_Core::getCache()->save($_messageData['header'], $cacheId, array('getMessageHeaders'));
     // prefetch body to cache
     if (Felamimail_Config::getInstance()->get(Felamimail_Config::CACHE_EMAIL_BODY, TRUE) && $_message->size < $this->_maxMessageSizeToCacheBody) {
         $account = Felamimail_Controller_Account::getInstance()->get($_folder->account_id);
         $mimeType = $account->display_format == Felamimail_Model_Account::DISPLAY_HTML || $account->display_format == Felamimail_Model_Account::DISPLAY_CONTENT_TYPE ? Zend_Mime::TYPE_HTML : Zend_Mime::TYPE_TEXT;
         Felamimail_Controller_Message::getInstance()->getMessageBody($_message, null, $mimeType, $account);
     }
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:31,代碼來源:Message.php

示例10: _invalidateRightsCache

 /**
  * invalidate rights cache
  * 
  * @param int   $roleId
  * @param array $roleRights  the role rights to purge from cache
  */
 protected function _invalidateRightsCache($roleId, $roleRights)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Invalidating rights cache for role id ' . $roleId);
     }
     $rightsInvalidateCache = array();
     foreach ($roleRights as $right) {
         $rightsInvalidateCache[] = strtoupper($right['right']) . Tinebase_Application::getInstance()->getApplicationById($right['application_id'])->name;
     }
     // @todo can be further improved, by only selecting the users which are members of this role
     $userIds = Tinebase_User::getInstance()->getUsers()->getArrayOfIds();
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($rightsInvalidateCache, TRUE));
     }
     foreach ($rightsInvalidateCache as $rightData) {
         foreach ($userIds as $userId) {
             $cacheId = Tinebase_Helper::convertCacheId('checkRight' . $userId . $rightData);
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                 Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Removing cache id ' . $cacheId);
             }
             Tinebase_Core::getCache()->remove($cacheId);
         }
     }
     $this->resetClassCache();
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:31,代碼來源:Roles.php

示例11: removeGroupMemberFromSqlBackend

 /**
  * remove one groupmember from the group
  *
  * @param  mixed  $_groupId
  * @param  mixed  $_accountId
  */
 public function removeGroupMemberFromSqlBackend($_groupId, $_accountId)
 {
     $groupId = Tinebase_Model_Group::convertGroupIdToInt($_groupId);
     $accountId = Tinebase_Model_User::convertUserIdToInt($_accountId);
     $where = array($this->_db->quoteInto($this->_db->quoteIdentifier('group_id') . '= ?', $groupId), $this->_db->quoteInto($this->_db->quoteIdentifier('account_id') . '= ?', $accountId));
     $this->groupMembersTable->delete($where);
     // invalidate cache
     $cacheId = convertCacheId('groupMembers' . $groupId);
     Tinebase_Core::getCache()->remove($cacheId);
     $cacheId = convertCacheId('groupMemberships' . $accountId);
     Tinebase_Core::getCache()->remove($cacheId);
 }
開發者ID:,項目名稱:,代碼行數:18,代碼來源:

示例12: _searchServerPlugins

 /**
  * Search server plugins from applications configuration
  *
  */
 protected static function _searchServerPlugins()
 {
     $cache = Tinebase_Core::getCache();
     if ($cache && ($plugins = $cache->load(self::TINEBASE_SERVER_PLUGINS))) {
         return $plugins;
     }
     // get list of available applications
     $applications = array();
     $d = dir(realpath(__DIR__ . '/../'));
     while (false !== ($entry = $d->read())) {
         if ($entry[0] == '.') {
             continue;
         }
         if (ctype_upper($entry[0]) && is_dir($d->path . DIRECTORY_SEPARATOR . $entry)) {
             $applications[] = $entry;
         }
     }
     $d->close();
     // get list of plugins
     $plugins = array();
     foreach ($applications as $application) {
         $config = $application . '_Config';
         try {
             if (class_exists($config)) {
                 $reflectedClass = new ReflectionClass($config);
                 if ($reflectedClass->isSubclassOf('Tinebase_Config_Abstract')) {
                     $plugins = array_merge($plugins, call_user_func(array($config, 'getServerPlugins')));
                 }
             }
         } catch (Exception $e) {
             Tinebase_Exception::log($e);
         }
     }
     // sort plugins by priority
     asort($plugins);
     $plugins = array_keys($plugins);
     if ($cache) {
         $cache->save($plugins, self::TINEBASE_SERVER_PLUGINS);
     }
     return $plugins;
 }
開發者ID:hernot,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:45,代碼來源:Core.php

示例13: cleanupCache

 /**
  * remove obsolete/outdated stuff from cache
  * notes: CLEANING_MODE_OLD -> removes obsolete cache entries (files for file cache)
  *        CLEANING_MODE_ALL -> removes complete cache structure (directories for file cache) + cache entries
  * 
  * @param string $_mode
  */
 public function cleanupCache($_mode = Zend_Cache::CLEANING_MODE_OLD)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Cleaning up the cache (mode: ' . $_mode . ')');
     }
     Tinebase_Core::getCache()->clean($_mode);
 }
開發者ID:hernot,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:14,代碼來源:Controller.php

示例14: emptyFolder

 /**
  * delete all messages in one folder -> be careful, they are completly removed and not moved to trash
  * -> delete subfolders if param set
  *
  * @param string $_folderId
  * @param boolean $_deleteSubfolders
  * @return Expressomail_Model_Folder
  * @throws Expressomail_Exception_IMAPServiceUnavailable
  */
 public function emptyFolder($_folderId, $_deleteSubfolders = FALSE)
 {
     $folder = $this->_backend->get($_folderId);
     $account = Expressomail_Controller_Account::getInstance()->get($folder->account_id);
     if ($folder) {
         $cache = Tinebase_Core::getCache();
         $cacheKey = 'Expressomail_Model_Folder_' . $folder->id;
         $cache->remove($cacheKey);
     }
     $imap = Expressomail_Backend_ImapFactory::factory($account);
     try {
         // try to delete messages in imap folder
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Delete all messages in folder ' . $folder->globalname);
         $imap->emptyFolder(Expressomail_Model_Folder::encodeFolderName($folder->globalname));
     } catch (Zend_Mail_Protocol_Exception $zmpe) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' ' . $zmpe->getMessage());
         throw new Expressomail_Exception_IMAPServiceUnavailable($zmpe->getMessage());
     } catch (Zend_Mail_Storage_Exception $zmse) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Folder could be empty (' . $zmse->getMessage() . ')');
     }
     if ($_deleteSubfolders) {
         $this->deleteSubfolders($folder);
     }
     return $folder;
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:34,代碼來源:Folder.php

示例15: reset

 /**
  * reset cache entries
  * 
  * @param string $class
  * @param string $method
  * @param string $cacheId
  * @return Tinebase_Cache_PerRequest
  */
 public function reset($class = null, $method = null, $cacheId = null)
 {
     $persistentCache = Tinebase_Core::getCache();
     $cacheId = $cacheId ? sha1($cacheId) : $cacheId;
     // reset all cache entries
     if (empty($class)) {
         if ($persistentCache instanceof Zend_Cache_Core) {
             foreach ($this->_inMemoryCache as $class => $methods) {
                 foreach ($methods as $method => $cacheEntries) {
                     foreach ($cacheEntries as $cacheId => $cacheEntry) {
                         $this->_purgePersistentCacheEntry($persistentCache, $class, $method, $cacheId);
                     }
                 }
             }
         }
         $this->_inMemoryCache = array();
         return $this;
     }
     // reset all cache entries of the given class
     if (empty($method)) {
         if ($persistentCache instanceof Zend_Cache_Core && isset($this->_inMemoryCache[$class])) {
             foreach ($this->_inMemoryCache[$class] as $method => $cacheEntries) {
                 foreach ($cacheEntries as $cacheId => $cacheEntry) {
                     $this->_purgePersistentCacheEntry($persistentCache, $class, $method, $cacheId);
                 }
             }
         }
         $this->_inMemoryCache[$class] = array();
         return $this;
     }
     // reset all cache entries of the method of the given class
     if (empty($cacheId)) {
         if ($persistentCache instanceof Zend_Cache_Core && isset($this->_inMemoryCache[$class]) && isset($this->_inMemoryCache[$class][$method])) {
             foreach ($this->_inMemoryCache[$class][$method] as $cacheId => $cacheEntry) {
                 $this->_purgePersistentCacheEntry($persistentCache, $class, $method, $cacheId);
             }
         }
         $this->_inMemoryCache[$class][$method] = array();
         return $this;
     }
     // reset single cache entry
     if (isset($this->_inMemoryCache[$class]) && isset($this->_inMemoryCache[$class][$method]) && isset($this->_inMemoryCache[$class][$method][$cacheId])) {
         if ($persistentCache instanceof Zend_Cache_Core) {
             $this->_purgePersistentCacheEntry($persistentCache, $class, $method, $cacheId);
         }
         unset($this->_inMemoryCache[$class][$method][$cacheId]);
     }
     return $this;
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:57,代碼來源:PerRequest.php


注:本文中的Tinebase_Core::getCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。