Caching of pages?

67 views
Skip to first unread message

Donald McLean

unread,
Sep 20, 2017, 3:36:43 PM9/20/17
to liftweb
Hi all,

I have an odd problem and hopefully someone has some thoughts they
would share with me.

My app is a single-page-app where parts of the page are replaced
dynamically. Every now and then, there is a glitch and the users will
reload the page.

On of the controls on the page is a set of Lift AJAX radio buttons.
And sometimes when the page is reloaded (even shift-reload), the radio
button has the wrong value selected. I added significant logging to
the code that draws the radio button, and when I reload the page, it
does not always get called. So, is there some kind of caching going on
somewhere? Or I am I missing something else important here?

Thanks,

Donald

Antonio Salazar Cardozo

unread,
Sep 21, 2017, 4:54:54 PM9/21/17
to Lift
Some browsers do aggressively cache, including for reloads, I believe. I would
check to see if any of the other parts of the page are affected. If there's a template
change, is that reflected? Does logging for other parts of the page get called? Does
a request even get logged?

If this is a problem, you could try sending Cache-Control headers and their ilk to
ask that the browser not cache your page if at all possible.
Thanks,
Antonio

Donald McLean

unread,
Sep 22, 2017, 9:45:32 AM9/22/17
to liftweb
Hi Antonio,

You're right - it doesn't look like any of the other parts are being
redrawn either.

I'm confused though, the LiftRules defaultHeaders:

"Cache-Control" -> "no-cache, private, no-store"


Thanks,

Donald

Antonio Salazar Cardozo

unread,
Sep 24, 2017, 9:28:53 PM9/24/17
to Lift
It seems like that header could be slightly better: https://stackoverflow.com/a/2068407/206493 .
In particular, they recommend ‘no-cache, no-store, must-revalidate’. It also seems like that's most
likely to work over an SSL connection.

That's all I really know… My understanding is browsers don't always follow caching directives,
particularly on reload.
Thanks,
Antonio

Donald McLean

unread,
Sep 27, 2017, 11:53:18 AM9/27/17
to liftweb
I added those options directly to the page via meta tags in the HTML
and it didn't help.

And the users find this really annoying, so I'll have to find some
other solution.

Thank you, Antonio.

On Sun, Sep 24, 2017 at 9:28 PM, Antonio Salazar Cardozo

Antonio Salazar Cardozo

unread,
Sep 27, 2017, 3:27:04 PM9/27/17
to Lift
Not sure a cache-control meta element would actually have any effect; see:


Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages