summaryrefslogtreecommitdiff
path: root/framework/Caching/TApplicationStateCacheDependency.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2015-01-20 19:19:55 +0100
committerFabio Bas <ctrlaltca@gmail.com>2015-01-20 19:19:55 +0100
commitd45b5615d48bff5373a6cda0728cb26332c3d962 (patch)
tree85f6e6d62317a66daa62745347a7636b1ca49546 /framework/Caching/TApplicationStateCacheDependency.php
parent7b843cc7df910a218272f328293f2541d53c23b2 (diff)
One class per file: framework/Caching/
Diffstat (limited to 'framework/Caching/TApplicationStateCacheDependency.php')
-rw-r--r--framework/Caching/TApplicationStateCacheDependency.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/framework/Caching/TApplicationStateCacheDependency.php b/framework/Caching/TApplicationStateCacheDependency.php
new file mode 100644
index 00000000..a5a3f764
--- /dev/null
+++ b/framework/Caching/TApplicationStateCacheDependency.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * TCache and cache dependency classes.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Caching
+ */
+
+
+/**
+ * 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>
+ * @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;
+ }
+} \ No newline at end of file