Welcome Guest, Not a member yet? Register   Sign In
Mysterious case of caching
#1

[eluser]Maglok[/eluser]
So I am developing this application at the moment on a new-ish server. The server is a Windows server.

Now my expertise in this area is quite limited, I am a developer, not a sysadmin.

I am unsure if it is a CI issue or not, but am doubting enough to ask regardless.

THE PROBLEM
Anytime I go to a page I have already been I see (most) of it as it was before, even if something changed.

EXAMPLES
I set flashdata after filling out a form to the tune of 'Form filled out ok', which is then displayed on top of the page it redirects to. It doesn't show up, not untill you do an additional refresh on the page.

Someone changes his avatar. The avatar will not show up as the new avatar until a refresh is done.

Login form on a page, it redirects to the page you are at (login is on all pages if you are not logged in). It will not show the 'logged in' logic of the view until we refresh again.

EXTRA INFO
I have tested this on IE7, IE8, Firefox and Chrome. They all seem to exhibit more or less the same characteristics.

Since logging in or displaying flashdata could be session related I first thought that might be it. Though updating an avatar does nothing to the current session.

I have created a quick non-CI page and put an image there. I then loaded the page. I then changed the code of the file to another image and loaded the URL again in a different tab. That just gives me the new image, thus leading me to believe it is something in CI I did. I can thus not reproduce this situation outside of CI.

THE QUESTION
What on earth is going on? Smile
#2

[eluser]Twisted1919[/eluser]
Maybe you need to disable output caching (if u didn't do that yet) .
Of course, you can have a MY_Controller.php and set the headers for all the pages so the cache won't happen .
#3

[eluser]Maglok[/eluser]
@Twisted1919: I am afraid I never turned it on to begin with. I take it you mean this: http://ellislab.com/codeigniter/user-gui...ching.html ?

UPDATE
I have moved the app to a different linux based server and I still get the caching situations. This is strongly implying it is CI.
#4

[eluser]mddd[/eluser]
CI doesn't cache if you don't tell it to.
Could it be something on your end? Some networks/proxies do caching of their own!
You could use something like Firebug or Webkit's web inspector to check the headers and see if you can learn something that way.
#5

[eluser]Maglok[/eluser]
Alright I have found a bit of the problem, the main issue still persists.

The redirect function states:

Quote:The optional second parameter allows you to choose between the "location" method (default) or the "refresh" method. Location is faster, but on Windows servers it can sometimes be a problem.

So I changed all my redirect(place, 'location') to redirect(place, 'refresh') this fixes the issues of flashdata not being displayed till after an additional refresh.

It does not fix when I stay on the same page without redirect.

EXAMPLES
Logging in and being redirected to a different page has no issues.

Changing the avatar and staying on the same page (reload to validate form, etc.) does not.

Something very strange is up, but I am beginning to see a pattern.




Theme © iAndrew 2016 - Forum software by © MyBB