Apache Commons logo

Commons JCS™

Upgrading from JCS 1.3 to 2.0

This document lists a number of things that changed in Commons JCS 2.0.

Package Names and Maven Coordinates

The main difference is the move to the Apache Commons project which lead to the change of the package names and Maven coordinates. So in all your code replace

import org.apache.jcs.*;
import org.apache.commons.jcs.*;
The Maven coordinates change from

Change Cache Access Object

JCS now uses different cache access objects depending on if you want to use cache groups or not. This was necessary because the cache access objects are now generic which saves you all the casts but doesn't allow different objects in the same cache anymore. You now use

import org.apache.commons.jcs.JCS;
import org.apache.commons.jcs.access.CacheAccess;
import org.apache.commons.jcs.access.GroupCacheAccess;

CacheAccess<String, City> cityCache = JCS.getInstance( "city" );
GroupCacheAccess<String, Country> countryCache = JCS.getGroupCacheInstance( "country" );

Adjusting the Configuration

Here again, change all package names in configuration entries from e.g.

and all MaxLifeSeconds lines to MaxLife like

The IndexedDiskCache recycle bin is no longer limited in size. So remove all references to MaxRecycleBinSize from the configuration files.