Re: Cache User queries?
Using the Cache (CakePHP book at http://book.cakephp.org/view/764/Cache)
you can cache anything!
When using the Cache::read/write functions, just identify the cached
data as a key together with the users identification. Example:
Cache::write('user_no_'.$this->Auth->user('id').'_favorites',
$favorites, 'daily');
The above will save the favorites in the "user_no_xxx_favorites" cache
file and keep for 24 hours (cache configuration daily).
But read the chapters, understand how it works, and hopefully you will
get the idea.
Enjoy,
John
On Feb 11, 3:03 am, "Dave" <make.cake.b...@gmail.com> wrote:
> Weird question.
>
> My user logs in and thru the site the page displays "favourite" icon if the
> user has bookmarked that page. My question is can you cache individual user
> data? When they login get all their bookmarked pages and cache that data
> then when they go thru the site grab the saved data in the cache rather than
> a query for every page?
>
> Thanks
>
> Dave
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home