0

If I activate the Codeigniter cache in the construct function of start controller (for example). So:

$this->output->cache(20); //20 minutes

If I do login in the principal page (built with Tank auth library) the complete web application is shown, if when I do logout, I reload the page , the complete web application is shown again. Why?

Obviously, This doesn't happen if the cache is disabled.

SilentAssassin
  • 468
  • 1
  • 9
  • 27
vicenrele
  • 971
  • 3
  • 19
  • 37

2 Answers2

1

If caching is enabled, you will always be taken page from cache, Until after 20 minutes

Winston
  • 1,758
  • 2
  • 17
  • 29
1

Codeigniter is caching the output of the first request. Any further requests will just return the cached page from the initial request.

As your app requires user state, you can't cache the entire page or all users will see the same thing (regardless of state).

rbaker86
  • 1,832
  • 15
  • 22
  • Then, I can't cache the initial page (login page) and the complete app individually. Is not? – vicenrele Feb 23 '13 at 22:15
  • 1
    If your app uses multiple views to compose a single page, you can cache page "fragments". E.g. header and footer. Here's a library that adds this support: https://github.com/EllisLab/CodeIgniter/wiki/Fragment-Caching-Library – rbaker86 Feb 24 '13 at 11:25