Bluedge Posted January 7, 2016 Share Posted January 7, 2016 I'm a bit confused about the best way to use the cache functions (Module and Tools classes) Let say: I have a simple module that displays the product on the day on the homepage 1. I make a query to the Database to retrieve the product 2. I return the result to a tempate product_of_the_day.tpl I would like to understand how to cache the result and the template for the current day. I have tried a strategy based on this :$this->_clearCache('product_of_the_day.tpl', $this->getCacheId(date('z'))); but it seems to never be cached. Can someone explain me the proper strategy to control the caching system or point me to a google tutorial on the web? Thanks Link to comment Share on other sites More sharing options...
NemoPS Posted January 9, 2016 Share Posted January 9, 2016 I do have a lesson on cache in my modules course, but if you are only interested in that I guess it's a bit expensive. You need to set the cache withreturn $this->display(__FILE__, 'leftColumn.tpl', $this->getCacheId('leftColumn'));(leftColumn is just an example)When you display a file, then you can check with isCached on the same method, Link to comment Share on other sites More sharing options...
Bluedge Posted January 10, 2016 Author Share Posted January 10, 2016 Hi Nemo1, This is what i'm doing but checking with isCached always return false. (Actually returns nothing but I cast it with (int) ) Link to comment Share on other sites More sharing options...
NemoPS Posted January 11, 2016 Share Posted January 11, 2016 Wait, what's your presta version? My local 1.6.1 doesn't work for example, it's bugged Link to comment Share on other sites More sharing options...
Bluedge Posted January 11, 2016 Author Share Posted January 11, 2016 Version is 1.6.0.14 Link to comment Share on other sites More sharing options...
NemoPS Posted January 13, 2016 Share Posted January 13, 2016 (edited) See if any default module works (like homefeatured)But being so close to 1.6.1 it might be buggedOf course, make sure caching is enabled in the bo Edited January 13, 2016 by Nemo1 (see edit history) Link to comment Share on other sites More sharing options...
Bluedge Posted January 14, 2016 Author Share Posted January 14, 2016 Any patch yet ? Link to comment Share on other sites More sharing options...
NemoPS Posted January 15, 2016 Share Posted January 15, 2016 my 1.6.1.2 works Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now