packages feed

lrucache 1.1.0.1 → 1.1.1

raw patch · 4 files changed

+18/−7 lines, 4 files

Files

Data/Cache/LRU/IO.hs view
@@ -1,7 +1,8 @@ -- | This module contains a mutable wrapping of an LRU in the IO -- monad, providing atomic access in a concurrent environment.  All -- calls preserve the same semantics as those in "Data.Cache.LRU", but--- perform updates in place.+-- perform updates in place.  All functions use a single atomic update+-- of the backing structure. -- -- The interface this module provides is opaque.  If further control -- is desired, the "Data.Cache.LRU.IO.Internal" module can be used in@@ -22,6 +23,7 @@     , pop     , size     , modifyAtomicLRU+    , modifyAtomicLRU'     ) where 
Data/Cache/LRU/IO/Internal.hs view
@@ -74,7 +74,15 @@ modifyAtomicLRU :: (LRU.LRU key val -> LRU.LRU key val)                 -> AtomicLRU key val                 -> IO ()-modifyAtomicLRU f (C mvar) = modifyMVar_' mvar (return . f)+modifyAtomicLRU f = modifyAtomicLRU' $ return . f++-- | Given a function that takes an 'LRU.LRU' and returns an IO action+-- producting one of the same type, use it to modify the contents of+-- this AtomicLRU.+modifyAtomicLRU' :: (LRU.LRU key val -> IO (LRU.LRU key val))+                 -> AtomicLRU key val+                 -> IO ()+modifyAtomicLRU' f (C mvar) = modifyMVar_' mvar f  -- | A version of 'MV.modifyMVar_' that forces the result of the -- function application to WHNF.
Data/Cache/LRU/Internal.hs view
@@ -121,8 +121,8 @@                            Nothing -> (lru, Nothing)                            Just lv -> (hit' key lru, Just . value $ lv) --- | Remove an item from an LRU.  Returns the new LRU, and if the item--- was present to be removed.+-- | Remove an item from an LRU.  Returns the new LRU, and the value+-- removed if the key was present. delete :: Ord key => key -> LRU key val -> (LRU key val, Maybe val) delete key lru = maybe (lru, Nothing) delete'' mLV     where
lrucache.cabal view
@@ -1,5 +1,5 @@ Name:                lrucache-Version:             1.1.0.1+Version:             1.1.1 Synopsis:            a simple, pure LRU cache License:             BSD3 License-file:        LICENSE@@ -19,11 +19,12 @@         .         Version History:         .+        1.1.1 - Add an additional modification function for AtomicLRUCache.+        .         1.1.0.1 - Update containers constraint to allow containers from ghc-7         .         1.1 - Add a Functor instance for LRUCache.-              Add a generic modification modification function-               for AtomicLRUCache.+              Add a generic modification function for AtomicLRUCache.         .         1.0 - Breaking API changes:                1) The newLRU smart constructor now makes the maximum