|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kataxxx Smarty Rookie
Joined: 08 Apr 2012 Posts: 10
|
Posted: Wed Oct 03, 2012 7:37 am Post subject: Cache resource and Compile cache at the same time. |
|
|
I've implemented those 2 resource with mongo. (Custom resources) and it works. One at a time!
If I have :
--$Smarty->display('template.html', $templade_id);
The resource cache works.
If I have:
--$Smarty->display('mongo:template.html', $templade_id);
The resource compile works.
Can't figure out what's wrong. I implemented all those functionalities.. I have to implement more?
Any idea? Here's my class methods that I use.
Code: | class Smarty_CacheResource_Mongo extends Smarty_CacheResource_Custom {
// PDO instance
protected $m;
public function __construct();
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
protected function fetchTimestamp($id, $name, $cache_id, $compile_id);
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
protected function delete($name, $cache_id, $compile_id, $exp_time);
}
class Smarty_Resource_Mongo extends Smarty_Resource_Custom {
// mongo
protected $m = null;
public function __construct();
protected function fetch($name, &$source, &$mtime);
private function saveTemplate($tpl_name, $tpl_source);
private function getTemplate($tpl_name);
protected function fetchTimestamp($name);
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null) {
parent::populate($source, $_template);
$source->recompiled = true;
}
}
$Smarty->caching_type = 'mongo';
$Smarty->cache_lifetime = 2;
$Smarty->caching = true;
$Smarty->registerResource('mongo', new Smarty_Resource_Mongo()); |
Thank you!!! |
|
Back to top |
|
kataxxx Smarty Rookie
Joined: 08 Apr 2012 Posts: 10
|
Posted: Thu Oct 11, 2012 2:30 pm Post subject: Re: Cache resource and Compile cache at the same time. |
|
|
May someone help me? I don't wanna use HDD/SSD for templates.
At least let me know if that's possible.
Thank you :) |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|