Discussions

News: JSP caching library OpenSymphony Cache 1.6.1 released

  1. OSCache is THE JSP caching library. Delivers in massive performance benefits on any servlet engine, as well as providing graceful error tolerance (e.g., in the event of a DB failure, cached content is served).

    Changelog : http://sourceforge.net/project/shownotes.php?release_id=53195
    Download : http://www.opensymphony.com/oscache/download.html

    This release contains LOTS of fixes, and plenty of new features.

    Among them:
    - ServletFilter to cache entire pages
    - Cache now caches images and other binary types
    - Cache is now i18n aware and should support all encodings
    - Memory / file caching are now independent and can be turned on or off individually (ie you can have JUST a file cache, or JUST a memory cache, or both)
    - Lots of work has gone into thread safety, it should be fairly right now, let us know if you still have problems (with thread safety ;)
    - Refactoring and new interfaces so the code is 'nice' - awww!
    - Auto-generated cache keys now contain the query string as well
    - Keys are now flushable by 'pattern' - see JavaDocs

    Enjoy!

    -mike
  2. Don't populat servlet engines (Tomcat, Rexip, Resin, Servletexec, JRun or even those from Websphere and Weblogic) already come with caching?

    Can OpenSymphony run on all these engines to obtain improvement?
  3. Most servlet engines support a form of caching but OSCache gives you much more flexibility. The nicest thing about it is using the JSP tag to cache just chunks of a page.

    For example, suppose you have a page that consists of lots of components (much like the one you are looking at now). Some of these could be quite intense on the server to generate for each request and could benefit from being cached, whereas others (such as cycling banner ads) should never be cached. You can just add the <cache>..</cache> tags around the suitable chunks of pages that are noticably slow, et voila.

    You also get a lot more flexibility. You have complete control over the cache - you can choose to flush it at any point and how to identify different caches. For example, you might want each user's session on a site to have its own cache, or each document in a custom CMS to have its own.

    It can also be looked at as a tool to improve error tolerance. Suppose you have a component on your page that obtains an up to the second news feed on your site from an external resource. Usually you want the very latest news to be obtained for each page, however there's a slight possibility that the external feed may not be available (you know what the internet is like). In this case you could catch a suitable exception and serve a cached page only if it cannot get the latest version.

    Re: Using with other servlet engines... OSCache is a standalone component of OpenSymphony and can be dropped into any Servlet2.2 compatible engine and can greatly improve the performance of existing JSP based apps with very little effort.

    -Joe
  4. Thanks for the info on OSCache. It seems to be rather interesting. Some questions please.
    1. My requirements is for a cache that has some sort of a key which comprises of 1..* variables as filters. If the key is matched, then display the cached content. This means that there are a number of this key, cache content pair.
    2. Does it support LRU/LFU?

    Thanks for any relevent info.

    h