Welcome Guest, Not a member yet? Register   Sign In
Problems with output cache
#13

[eluser]n0xie[/eluser]
Quote:I have a database driven website , which always shows in the header the image of the user profile and some additional info about him . Doesn’t matter the uri segment , the info is always there if the user is authed.
Now , guess what’s happening if i login to the system , then the cache is created , if i logout from the system , what do you think i will see in the header ?
This is widget like behaviour and as I explained above, you can use ajax calls to solve this: make the default not to show the profile name/picture. Make an ajax call to verify identity. Return profile name/pic. Update DOM to show it. There you just saved yourself from having to rebuild your entire page every request with an ajax call which will probably use about 40 bytes. You can even use some shiny javascript effect making it look all cool and stuff. (fade in photo anyone?)

Let me put it this way: do you really hit the database each time someone loads a page just to show his profile name?

Quote:Even more , my users profiles are like www.domain.com/username.html , if the cache file is created while an authed user is previewing his www.domain.com/his-name.html where he can see additional controls , what do you think will see a guest by visiting the same url ?
Cache the public profile page. Make the edit profile page a different url. Don't cache the edit page. Problem solved. Caching strategy is not to cache everything, it's caching frequently visited pages.

How many people might view the profile? Might be your whole userbase. How many people might edit the profile? Most likely just 1. Which of the 2 do you think is worth caching?

tldr: CI's caching is not the best implementation possible. Issues with logged in/state could be a problem. Even so, it still has it's uses and is hardly useless.


Messages In This Thread
Problems with output cache - by El Forum - 02-23-2010, 08:10 AM
Problems with output cache - by El Forum - 02-23-2010, 10:14 AM
Problems with output cache - by El Forum - 02-23-2010, 10:22 AM
Problems with output cache - by El Forum - 02-23-2010, 10:45 AM
Problems with output cache - by El Forum - 02-23-2010, 11:23 AM
Problems with output cache - by El Forum - 02-23-2010, 11:28 AM
Problems with output cache - by El Forum - 02-23-2010, 01:55 PM
Problems with output cache - by El Forum - 02-23-2010, 03:54 PM
Problems with output cache - by El Forum - 02-23-2010, 05:53 PM
Problems with output cache - by El Forum - 02-23-2010, 06:29 PM
Problems with output cache - by El Forum - 02-24-2010, 03:25 AM
Problems with output cache - by El Forum - 02-24-2010, 01:18 PM
Problems with output cache - by El Forum - 02-25-2010, 05:23 AM
Problems with output cache - by El Forum - 02-25-2010, 09:20 AM
Problems with output cache - by El Forum - 02-25-2010, 10:26 AM
Problems with output cache - by El Forum - 10-11-2010, 01:21 AM
Problems with output cache - by El Forum - 10-11-2010, 05:31 AM
Problems with output cache - by El Forum - 10-11-2010, 11:45 AM
Problems with output cache - by El Forum - 10-11-2010, 12:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB