org.nuiton.wikitty
Class WikittyCache

java.lang.Object
  extended by org.nuiton.wikitty.WikittyCache
All Implemented Interfaces:
WikittyServiceListener

public class WikittyCache
extends Object
implements WikittyServiceListener

Cette classe sert a introduire du cache dans wikitty. Elle sert a centraliser tous les appels au cache pour pouvoir simplement changer de librairie de cache si necessaire, meme si pour l'instant on s'appuie le JDK

Version:
$Revision$ Last update: $Date$ by : $Author$
Author:
poussin

Field Summary
protected  Map<String,Wikitty> wikittyCache
          keys are wikitty ids
 
Constructor Summary
WikittyCache()
          Create a soft cache.
WikittyCache(boolean soft)
          Init cache with specific reference type.
 
Method Summary
 void clearExtension(WikittyServiceEvent event)
           
 void clearWikitty()
          Clear all cache.
 void clearWikitty(WikittyServiceEvent event)
           
 boolean existsWikitty(String id)
           
 Wikitty getWikitty(String id)
          Return wikitty object if is in the cache, null otherwize.
 void putAllWikitty(Collection<Wikitty> all)
          batched put
 void putExtension(WikittyServiceEvent event)
          toto[1.0]
 void putWikitty(Wikitty e)
          Only realy put wikitty in cache, if not in cache or version is newer than one in cache
 void putWikitty(WikittyServiceEvent event)
           
 void removeAllWikitty(Collection<String> ids)
          batched remove
 void removeExtension(WikittyServiceEvent event)
           
 void removeWikitty(String id)
          Remove wikitty from cache.
 void removeWikitty(WikittyServiceEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wikittyCache

protected Map<String,Wikitty> wikittyCache
keys are wikitty ids

Constructor Detail

WikittyCache

public WikittyCache()
Create a soft cache.


WikittyCache

public WikittyCache(boolean soft)
Init cache with specific reference type.

Parameters:
soft - si vrai utilise un cache avec des reference Soft, sinon utilise des references static (utile pour les transactions)
Method Detail

existsWikitty

public boolean existsWikitty(String id)

getWikitty

public Wikitty getWikitty(String id)
Return wikitty object if is in the cache, null otherwize.

Parameters:
id -
Returns:
wikitty object or null

putWikitty

public void putWikitty(Wikitty e)
Only realy put wikitty in cache, if not in cache or version is newer than one in cache

Parameters:
e -

putAllWikitty

public void putAllWikitty(Collection<Wikitty> all)
batched put

Parameters:
all -

removeWikitty

public void removeWikitty(String id)
Remove wikitty from cache.

Parameters:
id - wikitty id to remove

removeAllWikitty

public void removeAllWikitty(Collection<String> ids)
batched remove

Parameters:
ids -

clearWikitty

public void clearWikitty()
Clear all cache.


clearWikitty

public void clearWikitty(WikittyServiceEvent event)
Specified by:
clearWikitty in interface WikittyServiceListener

putWikitty

public void putWikitty(WikittyServiceEvent event)
Specified by:
putWikitty in interface WikittyServiceListener

removeWikitty

public void removeWikitty(WikittyServiceEvent event)
Specified by:
removeWikitty in interface WikittyServiceListener

putExtension

public void putExtension(WikittyServiceEvent event)
Description copied from interface: WikittyServiceListener
toto[1.0]

Specified by:
putExtension in interface WikittyServiceListener

removeExtension

public void removeExtension(WikittyServiceEvent event)
Specified by:
removeExtension in interface WikittyServiceListener

clearExtension

public void clearExtension(WikittyServiceEvent event)
Specified by:
clearExtension in interface WikittyServiceListener


Copyright © 2009-2010 CodeLutin. All Rights Reserved.