I'm a .Internet developer who's beginning to complete increasingly more Java development at the office. I've got a specific question about caching which i hope everyone can solve or offer suggestions. We're beginning a java project that'll be used on the Linux box running JBoss. We're preparing in advance and then try to consider our caching strategy. One factor we wish to do would be to output cache the web pages since our content will probably be cacheable for 8 hrs approximately. I began searching at mod_cache which does what you want to do. The main one other requirement that I have to meet is the fact that for each request, I have to perform some custom logging. I want the fundamental request URL and more other business logic stuff and stuff it right into a database. My questions are these:

1) How do i put code in the mod_cache level to start the custom logging process?
2) I wish to queue these logging messages up in some way since i'd rather not visit the db with every request. An amount be the easiest method to tackle this?

I'd appreciate any suggestions or solutions should you got Them!

I suppose your planned setup is Apache httpd -> mod_cache -> mod_proxy/mod_jk -> JBoss

1) You cannot, since mod_cache in the Apache level doesn't even get lower to calling Java. Hence, you should see if mod_cache itself has some logging facility which you'll hook something in, or you should modify mod_cache and recompile it. It has nothing related to Java and that i don't believe it can be done in Java.

2) Again, this isn't a Java question when mod_cache is handling the response by itself without calling JBoss.

JBoss/Catalina/Tomcat are pretty fast as it pertains lower to delivering pages made by JSPs or any other web frameworks. Set the cache expiration date and allow the browser handle the cache.

You may consider using memcached rather. I'm not sure if there's a Tomcat/JBoss wrapper module with this program or otherwise. It enables you to cache nearly data that you could serialize making a string key value for.

You need to write an accessor for the thing you need, which attempts to pull stuff from the memcached process, and/or calls an electrical generator function upon cache miss (in addition to caching the generator's result). In this particular accessor, you can log cache hits and misses.

The memcached daemon is designed in C, obviously, therefore it will not "mark and sweep" itself to dying possessing data, unlike java (or the majority of the other "modern" language runtimes).

However, maybe mod_cache has some logging hooks. Perhaps you should consider that, because this will lighten the burden in your java process.

Is near to the kind of factor you're searching for?