| Thread Tools |
8th April 2004, 10:51 | #1 |
Member Join Date: May 2002
Posts: 3,711
| Apache cache I use apache (1.3.29) to serve doc's en xls's. As most docs are "static" i didn't notice that, when a document is changed, other users are served the unchanged document until a day or so. This is very annoying as everybody gets the previous version with all kinda misunderstandings as consequence. I first thought it was due to the browers cache, but even when cleared i get the previous version. So i should alter the apache config. I've been fiddling with the CacheNegotiateddocs + expire-directive (ExpiresDefault "modification plus 1 minute") but this doesn't give the result i want. I want all users to get the same altered doc or xls a minute after it is changed, or better, the second it is changed.
__________________ "Think of how stupid the average person is, and realize half of them are stupider than that." |
8th April 2004, 11:02 | #2 |
Madshrimp Join Date: May 2002 Location: 7090/Belgium
Posts: 79,021
| Apache (http://www.apache.org/) uses optional modules to include headers, including both Expires and Cache-Control. Both modules are available in the 1.2 or greater distribution. The modules need to be built into Apache; although they are included in the distribution, they are not turned on by default. To find out if the modules are enabled in your server, find the httpd binary and run httpd -l; this should print a list of the available modules. The modules we are looking for are mod_expires and mod_headers. If they aren't available, and you have administrative access, you can recompile Apache to include them. This can be done either by uncommenting the appropriate lines in the Configuration file, or using the -enable-module=expires and -enable-module=headers arguments to configure (1.3 or greater). Consult the INSTALL file found with the Apache distribution. Once you have Apache setup with the appropriate modules, you can use mod_expires to specify when objects should expire either in .htaccess files, or in the server's access.conf file. You can specify expire from either access or modification time, and apply it to a file type or as a default. See http://www.apache.org/docs/mod/mod_expires.html for more information, and speak with your local Apache guru if you have trouble (he will be the pasty white dude with long, unkempt hair). To apply Cache-Control headers, you'll need to use the mod_headers module, which allows you to specify arbitrary HTTP headers for a resource. See http://www.apache.org/docs/mod/mod_headers.html Here's an example .htaccess file that demonstrates the use of some headers. .htaccess files allow web publishers to use commands normally only found in configuration files. They affect the content of the directory they're in and their subdirectories. Talk to your server administrator to find out if they're enabled. ### activate mod_expires ExpiresActive On ### Expire .gif's 1 month from when they're accessed ExpiresByType image/gif A2592000 ### Expire everything else 1 day from when it's last modified ### (this uses the Alternative syntax) ExpiresDefault "modification plus 1 day" ### Apply a Cache-Control header to index.html <Files index.html> Header append Cache-Control "public, must-revalidate" </Files> Note that mod_expires automatically calculates and inserts a Cache-Control:max-age header as appropriate. Caching disabled in script can only be done on XML dialogs and therefore is not effective for audio files. Here are a series of code snippets to disable caching: Disabling caching in Active Server Page Code <% response.expires = -1 response.CacheControl = "no-cache" %><? xml version="1.0" ?> Disabling caching in PHP Code <?php header('Cache-Control: no-cache'); print('<?xml version="1.0" encoding="UTF-8" ?>'); ?> Disabling caching in Cold Fusion Code <cfheader name="Cache-Control" value= "no-cache"> <cfheader name="Expires" value="#Now()#"><? xml version="1.0" ?>
__________________ |
8th April 2004, 11:09 | #3 |
Member Join Date: May 2002
Posts: 3,711
| Will try, thanks Fast Eddy
__________________ "Think of how stupid the average person is, and realize half of them are stupider than that." |
8th April 2004, 12:43 | #4 |
Member Join Date: May 2002
Posts: 3,711
| Outcome : it works ! but IE : getting an error (send error - report to MS), didn't have this before Firefox : have to set browsercache to 0
__________________ "Think of how stupid the average person is, and realize half of them are stupider than that." |
8th April 2004, 12:46 | #5 |
Madshrimp Join Date: May 2002 Location: 7090/Belgium
Posts: 79,021
| how fast do you have the expiration set in apache?
__________________ |
8th April 2004, 13:21 | #6 |
Member Join Date: May 2002
Posts: 3,711
| ### Expires settings (1 min after mod) ExpiresActive On ExpiresDefault "modification plus 1 minute"
__________________ "Think of how stupid the average person is, and realize half of them are stupider than that." |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Intel Planning E3200 Pentium CPU? 45nm, 2.6Ghz, 1Mb L2 Cache | jmke | WebNews | 0 | 9th March 2009 23:59 |
Microsoft to sponsor the Apache Software Foundation | jmke | WebNews | 0 | 25th July 2008 20:25 |
First Intel Nehalem has 8MB cache | jmke | WebNews | 3 | 27th May 2008 01:53 |
Intel Core 2 Extreme QX6950 coming Q4, 3.33GHz, 12MB L2 cache | jmke | WebNews | 0 | 27th July 2007 16:46 |
Intel Server QuadCore CPU "Harpertown" has 12 MB cache, FSB 1333 | jmke | WebNews | 0 | 18th June 2007 10:51 |
Most efficient L2 cache usage: Intel shared or AMD dedicated? | jmke | WebNews | 0 | 23rd October 2006 14:04 |
How Much Cash for that Cache? AMD do not want you to have 1Mb cache | jmke | WebNews | 12 | 17th June 2006 17:05 |
Samsung's HDDs with Flash Cache to Emerge Along with Windows Vista | jmke | WebNews | 0 | 18th May 2006 17:05 |
Intel Preps 3.50GHz Server Chips with 8MB Cache | jmke | WebNews | 0 | 14th January 2005 10:58 |
Intel Itanium 2 to Get Additional Clock-Speed, Cache | jmke | WebNews | 0 | 25th May 2004 16:21 |
Thread Tools | |
| |