Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The issue is not really not a Zend Framework issue. It’s about directing the client (a web browser, in all likelihood) to cache the content on its side so that the next time it needs it, it doesn’t have to request it and the server doesn’t have to deliver it.
This is typically accomplished by sending cache headers from the server to the client. The precise headers you need to send depend upon how long you want the browser to cache. A Google search will show you those.
In a “standard” Zend Framework application, these external javascript and css resources are inside the
publicfolder of your application and are served directly by your web server. Zend Framework never even touches them. As a result, the method for sending those cache headers will not depend upon Zend Framework, but rather your web server.As an example, in Apache, if you have the mod_expires module, Apache itself can be instructed to send the correct cache headers. Add something like this to the
.htaccessinpublic/assetsdirectory:See the mod_expires documentation for more info.
Of course, when you update any of the content in that
public/assetsdirectory, you will want all clients to request the new content, not re-use the cached content. Changing the url of the requested resource by appending a query string – something like changing fromhttp://example.com/assets/js/myscript.jstohttp://example.com/assets/js/myscript.js?v=20120223– will force a new load.