CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#9617] Add a lifetime option to the Smarty->isCached function

avatar
Created By: Jean-Christophe Cuvelier (totophe)
Date Submitted: 2013-10-23 13:11

Assigned To:
Resolution: Won't Fix
State: Closed
Summary:
Add a lifetime option to the Smarty->isCached function
Detailed Description:
The lifetime option allow to define a particular lifetime check on a cached
template to be able to have a particular lifetime rather than a global lifetime
for it

History

Comments
avatar
Date: 2013-10-23 13:11
Posted By: Jean-Christophe Cuvelier (totophe)

Index: lib/classes/class.Smarty_CMS.php
===================================================================
--- lib/classes/class.Smarty_CMS.php	(revision 9032)
+++ lib/classes/class.Smarty_CMS.php	(working copy)
@@ -361,9 +361,10 @@
    * @param int $cache_id
    * @param int $compile_id
    * @param mixed $parent
+   * @param int $lifetime Lifetime of the cache
    * @return mixed
    */	
-  public function isCached($template = null,$cache_id = null,$compile_id =
null, $parent = null)
+  public function isCached($template = null,$cache_id = null,$compile_id =
null, $parent = null, $lifetime = null)
   {
     if( is_null($cache_id) || $cache_id === '' ) {
       $cache_id = $this->_global_cache_id;
@@ -371,6 +372,13 @@
     else if( $cache_id[0] == '|' ) {
       $cache_id = $this->_global_cache_id . $cache_id;
     }
+    if(!is_null($lifetime) && is_numeric($lifetime))    {
+        $global_lifetime = $this->cache_lifetime;
+        $this->setCacheLifetime($lifetime);
+        $is_cached = parent::isCached($template,$cache_id,$compile_id,$parent);
+        $this->setCacheLifetime($global_lifetime);
+        return $is_cached;
+    }
     return parent::isCached($template,$cache_id,$compile_id,$parent);
   }
      
avatar
Date: 2017-11-26 18:56
Posted By: Robert Campbell (calguy1000)

We are pulling smarty caching functionality out of CMSMS in 2.3.  Best to use
something like varnish etc.
      
Updates

Updated: 2017-11-26 18:56
resolution_id: 5 => 8
state: Open => Closed

Updated: 2013-10-23 13:11
resolution_id: => 5