packages feed

hedis-pile 0.3.0 → 0.3.1

raw patch · 3 files changed

+11/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hedis-pile.cabal view
@@ -1,5 +1,5 @@ name:           hedis-pile
-version:        0.3.0
+version:        0.3.1
 cabal-version:  >= 1.8
 build-type:     Simple
 stability:      Experimental
src/Database/Redis/Pile.hs view
@@ -20,6 +20,7 @@ 
 import qualified Database.Redis as R
 import qualified Database.Redis.Tags as RT
+import Data.Maybe (fromJust)
 
 -- | Stores computation results in Redis as hashSet. Computation fires only  
 --   if data absent in cache. Of course, to refresh the data, they must first 
@@ -108,7 +109,9 @@         void $ R.hmset withPrefix r
         setExpire ke
         RT.markTags [withPrefix] p t
-        return $ Just r
+        return $ case payload of
+            Nothing -> Just r
+            Just pl -> Just [(pl, fromJust $ lookup pl r)]
       where
         setExpire Nothing = return ()
         setExpire (Just ke) = void $ R.expire withPrefix ke
test/Database/Redis/Test/Pile.hs view
@@ -34,6 +34,12 @@             return (allData, Just 15, ["one"])
         ex <- R.ttl $ allPrefix `B.append` ":three"
         liftIO $ Right 15 @=? ex
+        r' <- RP.pile allPrefix "three" Nothing (Just "anydata") $ 
+            return (allData, Nothing, [])
+        liftIO $ Just [("anydata", "anydata")] @=? r'
+        r'' <- RP.pile allPrefix "three" Nothing (Just "anydata") $ 
+            return (allData, Nothing, [])
+        liftIO $ Just [("anydata", "anydata")] @=? r''
 
 caseStoredData :: Assertion
 caseStoredData = bracket_