[Opensource] configuring the cache
Michael Rimov
rimovm at centercomp.com
Mon Sep 16 23:01:39 PDT 2002
At 08:12 PM 9/16/2002 +0000, you wrote:
>Hi,
>
>I have some question regarding the cache.
>1) Is there any doc available about using the expresso's caching in the
>best way? Some sample would be great. This is one of the most powerfull
>features of the framework and I think that some elaboration in expresso's
>doc will be great.
No, but check out the test cases under Cache Manager as it shows simple
caches, but it doesn't get very deep into things such as
TTL. SecuredDBObject is also a fine example of Caching. But other than
Javadocs, I'm not sure how to help you.
>2) I saw that you have a field "cachesize" in the DBOBJLIMIT table. I
>guess that this is to indicate what is the maximum instances for a
>particular cache item.
Yes, although it's only SPECIFICALLY used by DBObjects for a setup way of
tweaking per DBObject cache sizes. You will have to set the cache size
yourself... perhaps a setup value for your custom cache.
>Well I am trying to utilize the cache by creating so cache instances by
>myself and I was wondering how to set the number of instances for my cache
>item. Basically I am creating a cache entry for a Vector.
One minor thing for future compatability. Change CacheManger.<methodName> to:
CacheManger.getInstance().<methodName> The static methods are eventually
going to be removed.
ex:
>if (!CacheManager.existsCache(getDBName(), cacheName)) {
> CacheManager.createCache(getDBName(), cacheName, true);
> }
> Vector myValues = CacheManager.getItems(getDBName(), cacheName);
> if (myValues == null) {
> myValues = getComboValuesNoCache(style);
> CacheManager.setItems(getDBName(), cacheName, myValues);
> }
Aside from the minor quibble listed above, what you're writing seems to be
correct. [BTW, the quibble is only for Expresso 4.1 on]
HTH!
-Mike
More information about the Opensource
mailing list