Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2005

Tip: Looking for answers? Try searching our database.

cached backed or self-emptying map

Thread view: 
Wendy Smoak - 29 Apr 2005 00:03 GMT
I'm trying to cache objects that are expensive to load from the database,
but I need the 'visible' object to be a Map so I can use it with JSTL.

I set about extending AbstractMap and the 'get' method was easy, but I got
stuck on the 'entrySet' method.  The cache I'm using does not expose its
underlying Map, which I understand... but I need that entrySet!  The
developers seem interested in working on it, so maybe they'll come up with a
solution.

Meanwhile, does anyone know of a good Java-based object cache that can
answer the question "What's in the cache" at any point in time?

Alternately, I could live with a Map that empties itself at midnight.  Or
something that I could schedule in Tomcat to replace a couple of context
attributes with empty maps.  I'm open to suggestions...

Some code and notes as I work through this are posted here:
http://wiki.wendysmoak.com/cgi-bin/wiki.pl?WhirlyCache

Signature

Wendy Smoak

Robert - 29 Apr 2005 00:50 GMT
Maybe I don't understand your problem but why won't a wrapped HashMap
work?  You just write the class to do the timing clean out at midnight.
I've used a Map of Maps at several companies I've worked for.  Also
you may check out EHCache we use that here for our hibernate objects.
Wendy Smoak - 29 Apr 2005 01:09 GMT
> Maybe I don't understand your problem but why won't a wrapped HashMap
> work?  You just write the class to do the timing clean out at midnight.
>  I've used a Map of Maps at several companies I've worked for.

It probably would for the self-cleaning Map, that was a recent idea, and I
don't [yet] know how to write the timing part.  I'm under the impression
that starting new threads in a Servlet Container environment is frowned
upon, so I want to make sure I don't break anything.

I would rather leave the cache size and expiration up to someone who knows
what they're doing... I'll check out EHCache, a quick look shows that it has
several 'getKeys' methods.  Thanks!

Signature

Wendy



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.