这段时间又发现一些问题.
1.放入Cache中的对象必须implements Serializable,不然会抛java.lang.ClassCastException异常
原因可以从JCS的源码中得知:
public void put( Object key, Object val, IElementAttributes attr )
.....................
CacheElement ce = new CacheElement( this.cacheControl.getCacheName(), (Serializable) key,
(Serializable) val );
.....................
注意其中的Serializable.
2.如果要定期清除cache,需要在cache.ccf中设置:
jcs.objCache.elementattributes.IsEternal=false
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/6906/viewspace-21892/,如需转载,请注明出处,否则将追究法律责任。