• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output cache library

#1
https://www.codeigniter.com/user_guide/g...ching.html

I would like to know how this caching is working. Every visitor has his own cache files or everyone has the same cache file? Also I have shopping cart there which is showing number of items / total price in cart. And when visitor adds something in cart the total amount should change. Question will it change in the cache file too or I need to delete the cache? Also if one visitor has 3 items in cart other visitors will have  the same amount or how does it work I am a bit confused
Reply

#2
Quote:I would like to know how this caching is working. Every visitor has his own cache files or everyone has the same cache file?
It is my understanding of this (and I have to say I have never used it myself) that it produces a copy of a fully rendered page. So everyone has the same cache file.

Quote:Also I have shopping cart there which is showing number of items / total price in cart. And when visitor adds something in cart the total amount should change. Question will it change in the cache file too or I need to delete the cache?
I do not think you can use the cache system for this type of page.

Quote:Also if one visitor has 3 items in cart other visitors will have the same amount or how does it work I am a bit confused
In this case, you cannot use the cache, otherwise the basket will be rendered once and shown again and again until the cache is deleted.

As I have said, I have not used this myself but it is for dynamic yet infrequently changing pages. Say you have a gallery of 100 images, descriptions and titles, dates etc all in a database. Then the pages for each image can be cached. The gallery page itself might be cached. But any page that has user based info in it cannot be cached. (As far as I understand it - which is probably why I have never used it).

Paul.
Reply

#3
If I understand your question right, you not need use DB and cache for cart. Use Sessions.

If you want to save cart items for logged in users for cross-browsing features, you can use user_id as a part of cache_id.
Reply

#4
I am using session for cart but since it is built in option I would have to tweak it somehow. Will have to look into it
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.