Skip to content

Commit

Permalink
v.1.21.1 fix cache not set
Browse files Browse the repository at this point in the history
  • Loading branch information
foo123 committed Aug 25, 2024
1 parent 72c8fa2 commit ee89f98
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tico

Tiny, super-simple but versatile quasi-MVC web framework for PHP (**v.1.21.0**)
Tiny, super-simple but versatile quasi-MVC web framework for PHP (**v.1.21.1**)


**Uses:**
Expand Down
30 changes: 26 additions & 4 deletions tico/Tico.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
*
* Tiny, super-simple but versatile quasi-MVC web framework for PHP
* @version 1.21.0
* @version 1.21.1
* https://github.com/foo123/tico
*
*/
Expand Down Expand Up @@ -39,7 +39,7 @@ public function value()

class Tico
{
const VERSION = '1.21.0';
const VERSION = '1.21.1';

public $Loader = null;
public $Router = null;
Expand Down Expand Up @@ -1198,7 +1198,14 @@ public function serveCache()
$this->_fixServerVars();

// if cache enabled serve fast and early
$cache = $this->get('cache');
try
{
$cache = $this->get('cache');
}
catch (Exception $e)
{
$cache = null;
}
if (is_object($cache) && method_exists($cache, 'get'))
{
$this->variable('tico_serve_cache__key', $this->_k);
Expand Down Expand Up @@ -1286,7 +1293,22 @@ public function serve()
$this->hook('tico_prepared_response');

// if cache enabled for this page, cache it
if ($this->variable('cache') && (is_object($cache = $this->get('cache')) && method_exists($cache, 'set') ) && ($cached = $this->cached()))
if ($this->variable('cache'))
{
try
{
$cache = $this->get('cache');
}
catch (Exception $e)
{
$cache = null;
}
}
else
{
$cache = null;
}
if (is_object($cache) && method_exists($cache, 'set') && ($cached = $this->cached()))
{
$this->variable('tico_cache_response__key', $this->_k);
$this->variable('tico_cache_response__content', $cached);
Expand Down

0 comments on commit ee89f98

Please sign in to comment.