Hi Thomas,
I know you're working on the new cache component (btw would be nice if
you could send an email with your planned architecture/api so that it
can be reviewed - like show the APIs) so I thought I should give you
some needs/ideas I have on this topic.
* We need several types of local caches. I can see at least the
following types:
- a timed cache. I need this for example to cache macros
- a cache with a fixed given capacity and expiring the oldest entries
(not really sure where we need this right now but it looks common
enough)
- a cache with a fixed given capacity and expiring the least accessed
entries (not really sure where we need this right now but it looks
common enough)
- a cache with unlimited capacity and bound only by the memory
available. The way to implement this is using PhantomReference.
Basically it's the JVM that calls back the reference to tell it it
needs memory. I was told that the new google collections api have some
code that do this (I think FinalizablePhantomReference). This cache is
the one I would use to save wiki pages' AST in memory.
Of course we shouldn't implement anything ourselves and we should use
existing framework(s) underneath our own API for the Cache API.
WDYT?
Links:
*
http://www.realjenius.com/node/377
*
http://www.javalobby.org/forums/thread.jspa?threadID=16520&messageID=91…
Thanks
-Vincent