redis 0.5.1 → 0.5.2
raw patch · 4 files changed
+18/−9 lines, 4 files
Files
- Database/Redis/Internal.hs +3/−0
- Database/Redis/Monad.hs +2/−2
- Database/Redis/Redis.hs +8/−6
- redis.cabal +5/−1
Database/Redis/Internal.hs view
@@ -230,3 +230,6 @@ recv_multi_n n = do this <- recv r tail <- fromJust `fmap` recv_multi_n (n-1) return $ Just (this : tail)++wait :: RedisState -> Int -> IO Bool+wait rs = IO.hWaitForInput (handle rs)
Database/Redis/Monad.hs view
@@ -480,8 +480,8 @@ publish klass msg = do r <- getRedis liftIO $ R.publish r klass msg -listen :: (WithRedis m, BS s) => m (Maybe (R.Message s))-listen = getRedis >>= liftIO . R.listen+listen :: (WithRedis m, BS s) => Int -> m (Maybe (R.Message s))+listen timeout = getRedis >>= liftIO . flip R.listen timeout save :: WithRedis m => m (R.Reply ()) save = getRedis >>= liftIO . R.save
Database/Redis/Redis.hs view
@@ -1386,15 +1386,17 @@ -- | Wait for a messages. ----- Important! Client will be blocked untill some message recieved!------ Message returned+-- Just Message returned or Nothing if timeout exceeded listen :: BS s => Redis+ -> Int -- ^ timeout -> IO (Maybe (Message s))-listen r = withState r $ \rs -> if isSubscribed rs == 0- then return Nothing- else recv rs >>= parseMessage >>= return . Just+listen r timeout = withState r $ \rs -> if isSubscribed rs == 0+ then return Nothing+ else do ready <- wait rs timeout+ if ready+ then recv rs >>= parseMessage >>= return . Just+ else return Nothing -- | Save the whole dataset on disk --
redis.cabal view
@@ -1,5 +1,5 @@ Name: redis-Version: 0.5.1+Version: 0.5.2 License: MIT Maintainer: Alexander Bogdanov <andorn@gmail.com> Author: Alexander Bogdanov <andorn@gmail.com>@@ -23,6 +23,10 @@ - initial support for (p)subscribe\/(p)unsubscribe\/publish . - getServer and getDatabase accessors added+ .+ New in this version:+ .+ - listen now have timeout argument Stability: beta Build-Type: Simple