OsCache and Memory Management

"Christian Liensberger" <[email protected]>
Newsgroups gmane.comp.java.open-symphony.os-cache
Organization DND INTERNET AGENCY - http://www.dnd.info
Message-ID <200404301112340.SM01664@waldemar>
Hi!

 

I have a few questions to your OsCache developer. Could you forward this
mail to a person that could answer my questions? Thank you.

 

 

I'm currently building a new cache that removes objects if it (the cache)
gets to big (in memory). It's a non-JSP base program (it's a
Windows-Java-Application). 

My biggest problem is that I can't set anywhere the size of the cache (I
mean the size that the cache should take max. in memory). My first attempt
was to create an own so called MemorySensitiveCacheAdministrator by deriving
from AbstractCacheAdministrator. I had only to add the MaxMemorySize field
and had to copy the whole other code from GeneralCacheAdministrator. I had
to do this since the GeneralCacheAdministrator creates immediately in the
constructor the cache. That's not so good since I have to call the super
constructor to parse the config file :-(

After having done this I'm currently facing the next problem. I have to
recreate/rewrite the whole Cache class. I can't derive from Cache since for
some reason cacheMap is not protected but private. If I call the super
constructor I can't pass the max. size of the cache and I have no
possibility to set it afterwards since I can't gain access to the cacheMap.

 

Now for me it seems that the only way to create this is to modify the
OsCache framework (not so good since I can't download then updates) or to
create somehow a static field that holds me the max. size of the cache (also
not so good).

 

This takes me to my final question: Is there any possibility that the Cache
class is somehow rewritten (in the official release) that I could gain
access to cacheMap? And is there any way that the AbstractCacheAdministrator
wouldn't create the cache in the constructor, but afterwards buy calling
some method? Could you add a constructor where I can't say not to create the
cache immediately?

 

Thank you

 

Sincerely

Christian Liensberger
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.