You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by "Anthony J. Biacco" <ab...@formatdynamics.com> on 2009/02/21 00:05:00 UTC

mem_cache and disk_cache acting differently when determine when to cache content?

Hi,

I'm serving out dynamic content from apache 2.2.11 that has a query
string on it. The output is different if the query string is different,
so I'm not ignoring the query string.
My problem is that when I use the mem_cache module for this and look at
the debug log, the effects seem different than when I use the disk_cache
module. For mem_cache on every request it shows it getting cached again
(and not getting served out of cache) or so that's how I'm reading it.
For disk_cache it seems to cache it fine and serve out of cache on
subsequent requests.

Log with mem_cache (all requests):
[Fri Feb 20 15:47:23 2009] [debug] mod_cache.c(131): Adding CACHE_SAVE
filter for /path
[Fri Feb 20 15:47:23 2009] [debug] mod_cache.c(138): Adding
CACHE_REMOVE_URL filter for /path
[Fri Feb 20 15:47:23 2009] [debug] mod_headers.c(740): headers:
ap_headers_output_filter()
[Fri Feb 20 15:47:23 2009] [debug] mod_cache.c(639): cache: Caching url:
/path?var=value
[Fri Feb 20 15:47:23 2009] [debug] mod_cache.c(645): cache: Removing
CACHE_REMOVE_URL filter.
[Fri Feb 20 15:47:23 2009] [info] mem_cache: Cached url:
http://x.x.x.x/path?var=value

Log with disk_cache (first request):
[Fri Feb 20 15:55:18 2009] [debug] mod_cache.c(131): Adding CACHE_SAVE
filter for /path
[Fri Feb 20 15:55:18 2009] [debug] mod_cache.c(138): Adding
CACHE_REMOVE_URL filter for /path
[Fri Feb 20 15:55:18 2009] [debug] mod_headers.c(740): headers:
ap_headers_output_filter()
[Fri Feb 20 15:55:18 2009] [debug] mod_cache.c(639): cache: Caching url:
/path?var=value
[Fri Feb 20 15:55:18 2009] [debug] mod_cache.c(645): cache: Removing
CACHE_REMOVE_URL filter.
[Fri Feb 20 15:55:18 2009] [debug] mod_disk_cache.c(962): disk_cache:
Stored headers for URL http://x.x.x.x/path?var=value
[Fri Feb 20 15:55:18 2009] [debug] mod_disk_cache.c(1051): disk_cache:
Body for URL http://x.x.x.x/path?var=value cached.

Log with disk_cache (subsequent request):
[Fri Feb 20 15:56:42 2009] [debug] mod_disk_cache.c(476): disk_cache:
Recalled cached URL info header http://x.x.x.x/path?var=value
[Fri Feb 20 15:56:42 2009] [debug] mod_disk_cache.c(749): disk_cache:
Recalled headers for URL http://x.x.x.x/path?var=value
[Fri Feb 20 15:56:42 2009] [debug] mod_cache.c(282): cache: running
CACHE_OUT filter
[Fri Feb 20 15:56:42 2009] [debug] mod_cache.c(296): cache: serving
/path

Response headers for content:
Date	Fri, 20 Feb 2009 23:01:08 GMT
Server	Apache
Cache-Control	max-age=300, must-revalidate
Expires	Fri, 20 Feb 2009 23:06:08 GMT
Connection	close
Transfer-Encoding	chunked
Content-Type	text/plain
Content-Language	En

Cache config (mem):
 <IfModule mod_cache.c>
                CacheEnable mem /path
                CacheDefaultExpire 300
                CacheIgnoreNoLastMod On
                CacheIgnoreQueryString Off
        <IfModule mod_disk_cache.c>
                CacheRoot /var/www/cache
                CacheDirLevels 1
                CacheDirLength 4
                CacheMaxFileSize 150000
                CacheMinFileSize 10
        </IfModule>
        <IfModule mod_mem_cache.c>
                MCacheRemovalAlgorithm LRU
                MCacheMaxObjectCount 100
                MCacheMaxObjectSize 150000
                MCacheMinObjectSize 10
                MCacheSize 10240
        </IfModule>
 </IfModule>

Cache config (disk):
 Same as mem config except CacheEnable line is "CacheEnable disk /path"

Any help is appreciated.

-Tony
---------------------------
Manager, IT Operations
Format Dynamics, Inc.
303-573-1800x27
abiacco@formatdynamics.com
http://www.formatdynamics.com