commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Klaasen (TeleRelay)" <tom.klaa...@telerelay.com>
Subject RE: [simplestore] inital check in
Date Wed, 16 Jan 2002 12:44:27 GMT
> -----Original Message-----
> From: Juozas Baliuka [mailto:baliuka@mwm.lt] 
> Sent: woensdag 16 januari 2002 13:49
> To: Jakarta Commons Developers List
> Subject: RE: [simplestore] inital check in
> 
> >
> >Jep, and I do the same in my app, but a layer lower (_not_ 
> in the cache,
> >but in the DB layer, which is the persistency layer I 
> described above).
> 
> It may interesting for you if you do the same in your app.
> 
> I use cashe this way:
> 
> //implementation of StorageCacheHelper not the last implementation, 
> synchronized in the last Layer.
> // Synchronization Layer implements the same interface.
> 
>   Object call(String name, Object args [] ){
> 
>   ResultWrapper wrp= null; // need wrapper for result if 
> result is null
> 
> 
>   //Cashe implementation wraps java.util.Map interfce, real cashe 
> implementation
> // depends on Map  implementation, and can be reused in any 
> kind of cache , 
> it can be HashMap,WeakMap, //SomeMRUMap.
> 
>      wrp =  map.get(name, args );
>      if(wrp != null) return wrp.result;
> 
>    Object result =  
> myRealStorageLayerImplementsTheSameInterfaceAs_this 
> (name, args );
>    wrp = new ResultWrapper(result);
> 
>    if(procDescriptor(name).flushCache()) {
>        procDescriptor(name).flush();
>   }
> 
>   if(procDescriptor(name).useCashe()){
>    map.put( KeyPair(name,args), wrp );
> }
> 
>     return  wrp.result;
> 
>    }
> 
> }
> 
> it is not fragment from real implementation, my real 
> implementation is more 
> complex and SQL dependant.
> But I have plans to fix it.

Very interesting... believe it or not, but I just had started
refactoring of my cache and store in the way you describe here. Maybe I
finally start to understand you ;-)

tomK

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message