[Building Sakai] Clustering a HashMap

Adrian Fish a.fish at lancaster.ac.uk
Tue Jan 18 06:29:41 PST 2011


> No,  its on a per element level.
> Its possible I miss read you email but I thought you said you were going to put a hashmap into the cache if not already there.
> eg
> Map<?,?>  myPayload = new HashMap<?,?>();
>
> ....
>
> String cacheKey = "akey";
>
> Cache cache = memoryService.newCache(....);
> if ( ! cache.containsKey(cacheKey) ) {
>     cache.put("akey", myPayload);
> }
>
>
> myPayload.put("key", "value");
> cache.put("akey", myPayload);
>
>
> -----------------------------
> as opposed to use the Cache as a Map eg
>
> Cache cache = memoryService.newCache(....);
> cache.put("key", "value");
>
> if you meant the latter, then you might be ok, it all depends on the size of your values.
> Ian
Ah, I'm with you. The entire map (myPayload) will get refreshed if one 
element in the map changes. I did mean the former but seeing as the 
object graphs are never going to get particularly deep bringing things 
up a level and storing them directly into the cache object sounds like 
the first thing to try.

Cheers again,
Adrian.

-- 
==================================
Adrian Fish
Software Engineer
Centre for e-Science
Bowland Tower South C Floor
Lancaster University
Lancaster
LA1 4YW
email: a.fish at lancaster.ac.uk

http://confluence.sakaiproject.org/display/YAFT/Yaft
http://confluence.sakaiproject.org/display/CLOG/Home
http://confluence.sakaiproject.org/display/BBB/Home



More information about the sakai-dev mailing list