请教jive中的缓存保存在HashMap的问题.

我在看到com.jivesoftware.util;包下的Cache类.

里有这样了头两个变量.
protected static long currentTime = CacheTimer.currentTime;


protected HashMap cachedObjectsHash;
为何这个HashMap不用static 变量呢,

但如果不用static,在读取缓存时又怎么定位到这里取缓存的数据呢?
比如说下面先取缓存里的数据:
public DbForumThread get(long threadID)
throws ForumThreadNotFoundException
{
if (!isEnabled()) {
return new DbForumThread(threadID, factory);
}
//Cache is enabled.
DbForumThread thread = (DbForumThread)cache.get(threadID);
if (thread == null) {
thread = new DbForumThread(threadID, factory);
cache.add(threadID, thread);
}
return thread;
}

从上面的方法里看到cache是怎么定位到是原来创建的那个保存的对像呢.
如果说HashMap不用全局static ,那么至少在系统里应有个cache对像是全局的吧.不然的话,应该是取不到缓存的数据才对吧??

但实现看不出在那个地方有创建唯一的.请帮忙解释一下,谢谢

比如说:在DbForum类里都是new一个cache. 如果第二次调用这个类,不是又new一个呢.这样怎么可能取得到缘存里的数据呢

protected Cache threadListCache = new Cache(16*1024, JiveGlobals.HOUR * 6);

而在存与取的时候.是下面那样写了.
CacheableLongArray longArray = (CacheableLongArray)threadListCache.get(key);

if (longArray != null) {
threadListCache.add(key, new CacheableLongArray(threads));
}

这样子如果能取得到原来对像的数据,是不是就是应用工厂模式的缘故呢.
所有的对像只有一个实例.呢???????请帮忙说明一下,谢谢...

DbForum中的缓存是用来保存这个Forum范围内的状态对象。

缓存并不是全部要求全局静态,我们需要抛弃那种使用静态和单态来实现缓存的唯一思想,Forum中的数据寄存在Forum中,而Forum则寄存在ForumFactory中;而ForumFactory则可能寄存在Web容器上(不一定这样实现)。

通过Jive的缓存告知我们,缓存实现也是一种业务逻辑的实现,是和业务逻辑交互得最深刻,因为缓存和数据库一样,都是状态的保存地,我们都承认数据库编程属于业务逻辑,难道不能认识到缓存编程也是一种业务逻辑实现。

那他不是也是借助于static单例对像来缓存的吗.如下面.jive都是采用这种方法调用呀..

public static ForumFactory getInstance(Authorization authorization) {
if (authorization == null) {
return null;
}
if (factory == null) {
synchronized(initLock) {
if (factory == null) {

String classNameProp =
JiveGlobals.getJiveProperty("ForumFactory.className");
if (classNameProp != null) {
className = classNameProp;
}
try {
Class c = Class.forName(className);
factory = (ForumFactory)c.newInstance();
}
catch (Exception e) {

return null;
}
}
}
}