TCache 0.5.3 → 0.5.4
raw patch · 3 files changed
+14/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/TCache.hs +2/−2
- Sample.hs +5/−2
- TCache.cabal +7/−2
Data/TCache.hs view
@@ -258,7 +258,7 @@ Just(tvr,_,_) -> return $ Just tvr where keyr= keyResource r - ti= t where TOD t _=unsafePerformIO getClockTime + ti= t `seq` t where TOD t _=unsafePerformIO getClockTime releaseTVars :: (IResource a)=> [a]-> IO() releaseTVars rs=do@@ -282,7 +282,7 @@ where keyr= keyResource r - ti= t where TOD t _=unsafePerformIO getClockTime+ ti= t `seq` t where TOD t _=unsafePerformIO getClockTime getResource r= do{mr<-getResources [r];return $! head mr}
Sample.hs view
@@ -45,7 +45,10 @@ -- buy is the operation to be performed in the example ---4 withResources gets a partial definition of each resource necessary for extracting the key, fill all the rest of the data structures (if found ) and return a list of Maybe Data. BuyIt is part of the domain problem. it receive this list and generates a new list of dat objects that are updated in the cache. buyIt is executed atomically.+--4 withResources gets a partial definition of each resource necessary for extracting the key, +--fill all the rest of the data structures (if found ) and return a list of Maybe Data. +--BuyIt is part of the domain problem. it receive this list and generates a new list of +--data objects that are updated in the cache. buyIt is executed atomically. user `buy` item=@@ -83,7 +86,7 @@ print $ "item data=" ++ show it -- write the cache content in a persistent store (invoque writeResource for each resource)- -- in a real application clearSyncCache can be used instead to adjust size and write the cache periodically+ -- in a real application clearSyncCacheProc can be used instead to adjust size and write the cache periodically syncCache (refcache :: Cache Data)
TCache.cabal view
@@ -1,7 +1,12 @@ name: TCache-version: 0.5.3+version: 0.5.4 synopsis: A Transactional data cache with configurable persistence -description: +description: + This version correct an error in the version 0.5.3. since 0.5 nothing in the code has changed except that+ the "&& <4" in the build dependencies added in the 0.5.3 the behaviour of getClocktime to be lazy, that indeed+ makes the cache write algoritm not to work, with the result tha no file is written. + This version force the strict evaluation and correct this error.+ Data.Tcache is a transactional cache with configurable persistence. It tries to simulate Hibernate for Java or Rails for Ruby. The main difference is that transactions are done in memory trough STM. There are transactional cache implementations for some J2EE servers like JBOSS.