http://zakirhyder.wordpress.com/2011/03/31/sweet-simple-caching-with-cakephp/
On Tue, Jan 10, 2012 at 7:51 PM, andrewperk <[email protected]> wrote: > Hello, > > I would like to be able to run a database query, but I only want the > query ran once per day. Then store the results from that query maybe > in a session or a cookie? > > I want to do this in order to reduce the amount of database calls when > the page is refreshed. > > Does anyone have any tips on how I could go about doing this? Here's > what I was thinking of doing: > > When a user comes to the page for the first time I store the current > date and time and run the db query. Then if they try to access the > page again I compare that stored date and time to 24 hours ahead, if > its less I don't do the query I just run return the previous results, > if it's greater, then I run the query again and return the new > results. Is this a proper way to do it? Or is this check essentially > doing the same thing as running a new query anyways since it has to > check dates in the session/cookie? > > Thanks. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
