diff options
author | xue <> | 2006-12-05 20:38:18 +0000 |
---|---|---|
committer | xue <> | 2006-12-05 20:38:18 +0000 |
commit | 176ee7e9b6c69cf42e7afeeb03db602237a49bc3 (patch) | |
tree | 07951817afa8464df6c25eb3fd600c4bedb71483 /framework | |
parent | 1649d87fcf0401eb6982cb5fcd4b4413ab86ace7 (diff) |
Added TApplicationStateCacheDependency.
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Caching/TCache.php | 30 |
1 files changed, 30 insertions, 0 deletions
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 @@ -599,6 +599,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 <qiang.xue@gmail.com>
+ * @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.
*
* TCacheDependencyList represents a list of cache dependency objects.
|