Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caching of static assets in Symfony

I came across an issue with a Symfony2 page. There appears to be some sort of not-client-side caching of static assets, eg. a zip file going on. For a few hours after updating the page the old file is downloaded and then it suddenly updates. I strongly suspect this may have something to do with the server or some proxy configuration so I doubt this has anything to do with Symfony itself as it would make little sense, but just as a sanity check - does S2 cache such files as well?

like image 997
konrad Avatar asked May 19 '16 09:05

konrad


1 Answers

Symfony2 uses a cache for assets and the pages.

For pages, clearing the cache is easy, this console command is sufficient

php app/console cache:clear --env=ENVIRONMENT YOUR WORKING IN

For the assets, there are multiple ways:

The assets got installed via symlink, those could be broken. To restore them:

php app/console assets:install --symlink

The assets got installed with a hardcopy, so you need to overwrite them after a change:

php app/console assets:install

The assets got dumped. If they got dumped, only a dump will update those assets:

php app/console assetic:dump

The dump will usually only be used in productive environments.

like image 187
KhorneHoly Avatar answered Nov 01 '22 17:11

KhorneHoly