Re: Re: Receiving the all the entries that belongs to a group

"Romulus Pasca" <[email protected]>
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <[email protected]>
I am using a database Chris,
but because the client (which is a stand alone application) requires huge amouns of data, is completly ineficient to get from database the query results at each request. In my opinion caching the result of a db query, is a classical use case for using a cache library . Unfortunalty, the current persisten listener of oscache, is very slow when is storing large amount of data.

----- Original Message -----
From: Chris Miller <[email protected]>
Date: Wed, 24 Dec 2003 17:46:54 +0000
To: [email protected]
Subject: [Opensymphony-oscache] Re: Receiving the all the entries that      belongs to a group

> You're using the wrong tool to solve your problem. You really should be 
> using a database for this, it's exactly the type of problem they're 
> designed to handle after all!
> 
> 
> Romulus Pasca wrote:
> > I have in my application a huge cache which cannot be keep it in
> > memory(arround 200MB). So I intended to use a cache with a small
> > memory size, and unlimited disk size. Also my entries should never
> > expire(are read-only persistent objects). I wanted to keep different
> > type of entries(I have around 25-50 types of objects that should be
> > cached) in different groups. The keys for entry are a specific prefix
> > for each group appended to the hash code of the object (which is
> > guaranted to be unique). For some types of entries, for which I load
> > all the required data at startup(other entries can be added also
> > during the application life time, but these entries are never
> > deleted) I have a business requirement, which asks me for all the
> > entries of that type. So it looks like I need to get all entries for
> > a group(both from memory and disk)- a statical snapshot with the
> > members of the group at a specific time. 
> > 
> > Assuming that it's ok for me to get a statical snapshot of a group, I
> > added to the Cache class the following methods:
> > 
> > public Object[] getGroupFromCache(String groupName, Class entryType) {
> >         Set groupEntries = cacheMap.getGroup(groupName);
> >         ArrayList result = new ArrayList();
> >         if (groupEntries != null) {            
> >             Iterator itr = groupEntries.iterator();            
> >             while (itr.hasNext()) {
> >                 try {
> >     result.add(getFromCache((String) itr.next()));                    
> >                 } catch (NeedsRefreshException ne) {
> >                     //just ignore this entry
> >                 }
> >             }
> >         }
> > return result.toArray((Object[])
> > java.lang.reflect.Array.newInstance(entryType, result.size()));
> >     }
> > 
> >     public Object[] getGroupFromCache(String groupName) {
> >         return getGroupFromCache(groupName, Object.class);
> >     }
> > Is in your opinion, Chris this code ok? 
> > 
> > Regarding the performance of the OSCache(because I follow the
> > performence discussion about oscache form this mailing list), I have
> > big performance problems with my caching model. As I told you I need
> > a huge disk-based cache for my application. At my first test with
> > OSCache, I was tring to store each item of a big search in the
> > cache(there was thousands of items, with a total size of 35MB).
> > Without OSCache, the time for this serach was just around a minute.
> > When I was trying to store these entries with OSCache, the time jump
> > to more then 2 hours.  So it looks that the default persistent
> > listener is not suitable for such kind of scenarios...
> > 
> > Best Regards and Merrie Christmas!
> > Romulus
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
> Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> Opensymphony-oscache mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-oscache

-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
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.