简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM