konrad konrad - 8 months ago 66
PHP Question

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?

Edit: I don't understand how this question is too broad? I ask whether Symfony2 caches static assets or no. This is a question about a particular behavior of a particular version of particular framework concerning a particular kind of assets. What should be narrowed down?

Actually the reasons for putting the question on hold seem a bit broad, don't they?


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.