From 176ee7e9b6c69cf42e7afeeb03db602237a49bc3 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 5 Dec 2006 20:38:18 +0000 Subject: Added TApplicationStateCacheDependency. --- HISTORY | 3 ++- framework/Caching/TCache.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 1dd78376..03d22c63 100644 --- a/HISTORY +++ b/HISTORY @@ -14,7 +14,8 @@ NEW: TQueue (Qiang) NEW: TSessionPageStatePersister (Qiang) NEW: TFeedService, TRssFeedDocument (Knut, Qiang) NEW: TJsonService -NEW: TCacheDependency, TFileCacheDependency, TDirectoryCacheDependency, TGlobalStateCacheDependency, TChainedCacheDependency +NEW: TCacheDependency, TFileCacheDependency, TDirectoryCacheDependency (Qiang) +NEW: TGlobalStateCacheDependency, TChainedCacheDependency, TApplicationStateCacheDependency (Qiang) Version 3.0.6 December 4, 2006 ============================== diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php index f40737fc..44940d18 100644 --- a/framework/Caching/TCache.php +++ b/framework/Caching/TCache.php @@ -598,6 +598,36 @@ class TChainedCacheDependency extends TCacheDependency } +/** + * TApplicationStateCacheDependency class. + * + * TApplicationStateCacheDependency performs dependency checking based on + * the mode of the currently running PRADO application. + * The dependency is reportedly as unchanged if and only if the application + * is running in performance mode. + * + * You may chain this dependency together with other dependencies + * so that only when the application is not in performance mode the other dependencies + * will be checked. + * + * @author Qiang Xue + * @version $Id$ + * @package System.Caching + * @since 3.1.0 + */ +class TApplicationStateCacheDependency extends TCacheDependency +{ + /** + * Performs the actual dependency checking. + * This method returns true if the currently running application is not in performance mode. + * @return boolean whether the dependency is changed or not. + */ + public function getHasChanged() + { + return Prado::getApplication()->getMode()!==TApplicationMode::Performance; + } +} + /** * TCacheDependencyList class. * -- cgit v1.2.3