Jive缓存

maer2003 04-07-15

jive中的对象大小是怎么确定的?如DbForum对象的getSize()方法,
是不是按数据库中对应表的字段类型字节数累加,这里不大懂,谁可以帮我解释一下吗?


public int getSize() {
// Approximate the size of the object in bytes by calculating the size
// of each field.
int size = 0;
size += CacheSizes.sizeOfObject();
// overhead of object
size += CacheSizes.sizeOfObject();
// factory
size += CacheSizes.sizeOfLong();
// id
size += CacheSizes.sizeOfString(name);
// name
size += CacheSizes.sizeOfString(description);
// description
size += CacheSizes.sizeOfDate();
// creation date
size += CacheSizes.sizeOfDate();
// modified date
size += CacheSizes.sizeOfMap(properties);
// properties
size += threadListCache.getMaxSize();
// thread list cache
size += messageListCache.getMaxSize();
// message list cache
size += threadCountCache.getMaxSize();
// thread count cache
size += messageCountCache.getMaxSize();
// message count cache
size += CacheSizes.sizeOfObject() +
CacheSizes.sizeOfLong() * 5;
// approx of pop threads
size += CacheSizes.sizeOfInt() * 4;
// moderation values
size += CacheSizes.sizeOfObject();
// filter manager
System.out.println(
"The Forum's Size is(Form DbForum):"+size);
return size;
}

banq
2004-07-18 09:47

计算被缓存的大小,用来精确计算Jive运行时占据多少缓存,为后台管理调整可用缓存提供决策依据。

这个功能一般不需要,过分学究了一点,访问量极其庞大时才有作用