Magnus ?or Torfason wrote:
> I'd like to propose changes to the caching mechanism in Turbine.
> 
> 1 - Multiple caches
> -------------------
> Instead of there being a single global cache service, there
> would be a possibility of creating multiple Caches, each with
> it's own set of objects in cache.  This would be somewhat
> similar to the way the PoolBrokerService is used.

This is similar to what we have done in our project here at e-point
(which depends pretty heaviliy on in-memory caching of information)

We have a CacheBroker class that manages a number of cache facilities,
that you can request for it by a String identifier. Each facility
has a set of properties (like capacity, or expiry time) and custom
implementation class.

We have Cache interface that simply extends Map interface, and BaseCache
class that has instance variable of Map type, and a set of methods
implementig Map interface that delegate functionality to the contained
Map object.
For implementing a specific caching alogrithm (most notably LRU) we 
extend BaseCache class, that creates a synchronized HashMap as the
underlying Map object and override get/put methods to use wrapper
object (that are instances of an inner helper class) for storing
values. Wrapper object contain a timestamp. The put method check
current capacity of the cache upon request of inserting a new
object into the cache, and calls removeLRU method. The removeLRU
method uses timestamps in wrapper objects to find the object
to be removed.

In our caching implementation, arbitrary Objects can be item
identifiers (keys). The type we use most commonly is actualy
Integer.

I think that our caching system would integrate well
with Turbine's. GlobalCacheService would keep a reference
to a special facility named "turbine.global" or something,
and could impose String limitation on keys.

Once agreement is reached upon the functinality that the caching
system should have, I can shedule one of our programers to tailor
the code we have to Turbine standards, and submit it.

Rafal


--
Rafal Krzewski
Senior Internet Developer
mailto:[EMAIL PROTECTED]
+48 22 8534830 http://e-point.pl


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to