Some more thoughts: 1) Actually we can probably use the google collections api for all our needs. For example it has http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common... 2) I'm not sure the PhantomReference is correct. It would be useful if we wanted to save the AST on disk for example but I don't know if that would win us processing time or not. It may. Otherwise a SoftReference would be enough. The difference is that with PhantomeReference the JVM calls you before the item is reclaimed so you can do something with it before it's too late... 3) If we want to go in this direction we'll need to decide if we want to continue using only the Apache Collections fwk or if it's ok to use both google's and apache's. 4) Do you know of any existing cache framework that we could use directly? (I haven't researched this but you probably have). Thanks -Vincent On May 27, 2008, at 10:35 AM, Vincent Massol wrote:
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=9182240...
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs