Caching assets, but excluding some


#1

Hello,

I am finding there is considerable lag in loading the UF backend. I assume I need to enable the caching options.

We have a javascript application, which may update multiple times a day. Last time we enabled the Twig cache, it would not load the latest version of the app.

What caching options do you recommend, for the assets (CSS/JS etc), but excluding certain files that need to be updated frequently?

Thanks


#2

Things like the TWIG cache will need to be manually purged whenever something that uses them is changes (they are fairly stupid, and have no automatic cache buster that I’m aware of).

For the frequently updated files, it depends. If the CSS or JS has a unique hash then you can go nuts on the expiration time, if not you’ll need to use a different strategy (like adding a URL arg based on the last modified date and then caching it until the end of time, something I’m looking to add to UF/Assets in the future actually).

As for API slowless, there is a long list of possible causes both in UF itself and the environment. Only thing I can recommend is trying to track down where the bottleneck is, and go from there.


#3

Thanks!

How do you purge the Twig cache?

For the time being, I am loading my app through the UF/Twig routing system. So it gets cached as well. And newer updates are not picked up it seems.

My app files do have a unique hash, luckily.

The API is not particularly slow. It’s fine. I am mainly having an issue with UF’s interface and loading the dashboard etc…