ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: To monitor used cache model size
Date Sat, 23 Sep 2006 13:16:37 GMT
You can sort of see into the CacheModel:

---
  SqlMapClientImpl impl = (SqlMapClientImpl) sqlMap;
  SqlMapExecutorDelegate delegate = impl.delegate;

  Iterator cacheModelNames = delegate.getCacheModelNames();
  while(cacheModelNames.hasNext()){
    String model = (String) cacheModelNames.next();
    CacheModel cacheModel = delegate.getCacheModel(model);
    System.out.println(model + ": " + cacheModel.getHitRatio() + "% hit ratio");
  }
---

Right now, there just is not much to see. If you want more, feel free
to patch the CacheModel class to expose stuff, and attach it to a JIRA
issue.

Larry


On 9/22/06, Nathan Maves <nathan.maves@gmail.com> wrote:
> Hmm... if you really plan to keep all available values in the cache
> why not just load them all into memory at startup of your app.  In
> your case you are using an LRU cache which is designed for maximizing
> performance for you most used objects, while limiting your footprint
> in memory.
>
> To answer your question I do not believe that you can monitor this
> right now though ibatis.
>
> Nathan
>
> On 9/22/06, Zhao, Qintao (Contractor) <qintao_zhao@fanniemae.com> wrote:
> >
> >
> >
> > All,
> >
> > I have a requirement to monitor the cache size used by a cache model. Say I
> > have the following cache model defined in a SqlMap,
> >
> > <cacheModel id="MDC_PRFL-cache" type="LRU" readOnly="true"
> > serialize="false">
> > <flushInterval hours="168" />
> > <property name="cache-size" value="2000" />
> > </cacheModel>
> >
> > I would like to know the actual size used by cache during runtime.  Could
> > someone help me out ?  We want to make sure the cache is
> > big enough to hold all cached objects in the future.
> >
> > thanks a lot,
> >
> > Qintao
> >
>

Mime
View raw message