JCS – Upgrading from JCS 1.3 to 2.0 (original) (raw)

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

with

import org.apache.commons.jcs.*;

The Maven coordinates change from

org.apache.jcs jcs 1.3

to

org.apache.commons commons-jcs-core 2.0

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.

jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes

to

jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes

and all MaxLifeSeconds lines to MaxLife like

jcs.default.elementattributes.MaxLifeSeconds=7

to

jcs.default.elementattributes.MaxLife=7

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