Archive for May, 2007

Java Caching System

Caching web pages and other data in distributed environment makes your application faster and better. I was wondering if Java has something for caching web pages for fast response and better performance. Few days back I found Java Caching System (JCS) project on Apache Jakarta Projects website.

JCS is an open source library for creating distributed caching system to speed up your applications. JCS is a general purpose caching system that can be used in web applications, services, and stand alone Java applications. The JCS goes beyond simply caching objects in memory. It provides numerous additional features:

  • Memory management
  • Disk overflow (and defragmentation)
  • Thread pool controls
  • Element grouping
  • Minimal dependencies
  • Quick nested categorical removal
  • Data expiration (idle time and max life)
  • Extensible framework
  • Fully configurable runtime parameters
  • Region data separation and configuration
  • Fine grained element configuration options
  • Remote synchronization
  • Remote store recovery
  • Non-blocking “zombie” (balking facade) pattern
  • Lateral distribution of elements via HTTP, TCP, or UDP
  • UDP Discovery of other caches
  • Element event handling
  • Remote server chaining (or clustering) and failover

I will be exploring the API in coming weeks and publish a small tutorial about how to use them in web application.

Java Foreach Loop

Java 5 introduced foreach loop, a much needed feature since it was first relaeased. Java foreach loop provides code simplicity, readability and eliminates the repetition of code that we write for type casting and assignments, when we are iterating arrays and collection objects.

When used with generics nothing is more apealing loop than foreach. I was reading an article “What Java foreach loop can do?“, which describes every thing a developer needs to know about for eachloop.