Skip to main content

Timeline for Ignore cache in preprocess function

Current License: CC BY-SA 3.0

11 events
when toggle format what by license comment
Jan 19, 2018 at 9:25 vote accept MoritzLost
Jan 18, 2018 at 21:28 answer added Berdir timeline score: 2
Jan 17, 2018 at 11:25 comment added Clive Edge Side Includes - basically placeholders that get resolved by a reverse proxy (eg Varnish).
Jan 17, 2018 at 11:23 comment added MoritzLost @Clive Fair enough, I will weigh those options against each other .. maybe I can just lower the cache retention time for the homepage (haven't looked into that yet, but I assume that's possible in some way) so the selected 'random' image will be refreshed regularly at least. What's ESI?
Jan 17, 2018 at 11:11 comment added Clive You're in the realms of "what's possible?" here, though - whichever way you go you're going to be making a compromise. If you don't use ajax you'll need to turn off the page cache for at least that page, which brings with it inevitable performance issues (no caching on the home page will probably make Google et al unhappy with response times). If you do use ajax, you're going to need to come up with a placeholder-based solution. If you're feeling particularly adventurous maybe you could look into using ESI
Jan 17, 2018 at 10:34 comment added MoritzLost @Clive But if I use ajax, the images will only start loading once the document is ready, the users will notice that ..
Jan 17, 2018 at 10:08 comment added Clive @MoritzLost Unless you have a seriously esoteric use case, you should probably consider the ajax approach. It solves your caching problem, and makes no difference to your users (they don't know whether the image was loaded as part of the normal page build or via ajax, and probably wouldn't care even if they did). The only minor concern is if you really need search engines to pick up the image and its alt. Even then, the big boys can execute JS these days so you're probably covered
Jan 17, 2018 at 9:56 comment added 4uk4 This is more a general problem, anonymous traffic is cached on all levels and normally you don't want to disable this for performance reasons. Ajax in this case is rather simple, you don't need the ajax implementation of the form api, you can use jquery ajax and a controller to deliver the images.
Jan 17, 2018 at 9:44 comment added MoritzLost @4k4 max-age only works for logged in users? I didn't know that, can you link me to some source that explains this concept further? I'm afraid loading in ajax isn't an option for this particular problem. Is there another way? Also could you provide a code example for this?
Jan 17, 2018 at 9:41 comment added 4uk4 Yes, you can set max-age in preprocess, but this only works for logged-in users. For anonymous users I would load the image in an ajax call.
Jan 17, 2018 at 9:23 history asked MoritzLost CC BY-SA 3.0