Caching is an essential to the majority of web applications. Let's face it: most of the work done in an average web application (especially public ones) is repetitive, either the same user requesting the same information multiple times, or multiple users requesting the same information. The question is always: "How long do I cache"?
We just finished building the new website for a well-known Dutch newspaper. The old website had a 15 minute TTL cache and we knew that wasn't going to cut it in the new website. Visitors want to see new articles and updates to articles the minute they're published, not 15 minutes later. Therefore, we developed a scalable caching mechanism with active, fine-grained cache invalidation using just EhCache along with Java and Spring concepts you're probably already familiar with. The solution we developed works in a distributed environment without the need for expensive distributed cache solutions.
In this blog post I'll describe how we did it.
Our website shows lists of articles. Only the title and a summary are shown. Clicking on the article will retrieve and display the full article. Articles can contain pictures. The first picture is used as the headline picture, and is shown with the article summary in article lists. Read the rest of this entry »