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
with
import org.apache.commons.jcs.*;
The Maven coordinates change from
<dependency>
<groupId>org.apache.jcs</groupId>
<artifactId>jcs</artifactId>
<version>1.3</version>
</dependency>
to
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jcs-core</artifactId>
<version>2.0</version>
</dependency>
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.
|