redis-resp 0.4.0 → 1.0.0
raw patch · 4 files changed
+76/−23 lines, 4 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Redis.Command: Append :: Resp -> Command Int64
- Data.Redis.Command: Auth :: Resp -> Command ()
- Data.Redis.Command: BLPop :: Int64 -> Resp -> Command (Maybe (Key, a))
- Data.Redis.Command: BRPop :: Int64 -> Resp -> Command (Maybe (Key, a))
- Data.Redis.Command: BRPopLPush :: Int64 -> Resp -> Command (Maybe a)
- Data.Redis.Command: BgRewriteAOF :: Resp -> Command ()
- Data.Redis.Command: BgSave :: Resp -> Command ()
- Data.Redis.Command: BitAnd :: Resp -> Command Int64
- Data.Redis.Command: BitCount :: Resp -> Command Int64
- Data.Redis.Command: BitNot :: Resp -> Command Int64
- Data.Redis.Command: BitOr :: Resp -> Command Int64
- Data.Redis.Command: BitPos :: Resp -> Command Int64
- Data.Redis.Command: BitXOr :: Resp -> Command Int64
- Data.Redis.Command: DbSize :: Resp -> Command Int64
- Data.Redis.Command: Decr :: Resp -> Command Int64
- Data.Redis.Command: DecrBy :: Resp -> Command Int64
- Data.Redis.Command: Del :: Resp -> Command Int64
- Data.Redis.Command: Discard :: Resp -> Command ()
- Data.Redis.Command: Dump :: Resp -> Command (Maybe ByteString)
- Data.Redis.Command: Echo :: Resp -> Command a
- Data.Redis.Command: Exec :: Resp -> Command ()
- Data.Redis.Command: Exists :: Resp -> Command Bool
- Data.Redis.Command: Expire :: Resp -> Command Bool
- Data.Redis.Command: ExpireAt :: Resp -> Command Bool
- Data.Redis.Command: FlushAll :: Resp -> Command ()
- Data.Redis.Command: FlushDb :: Resp -> Command ()
- Data.Redis.Command: Get :: Resp -> Command (Maybe a)
- Data.Redis.Command: GetBit :: Resp -> Command Int64
- Data.Redis.Command: GetRange :: Resp -> Command a
- Data.Redis.Command: GetSet :: Resp -> Command (Maybe a)
- Data.Redis.Command: HDel :: Resp -> Command Int64
- Data.Redis.Command: HExists :: Resp -> Command Bool
- Data.Redis.Command: HGet :: Resp -> Command (Maybe a)
- Data.Redis.Command: HGetAll :: Resp -> Command [(Field, a)]
- Data.Redis.Command: HIncrBy :: Resp -> Command Int64
- Data.Redis.Command: HIncrByFloat :: Resp -> Command Double
- Data.Redis.Command: HKeys :: Resp -> Command [Field]
- Data.Redis.Command: HLen :: Resp -> Command Int64
- Data.Redis.Command: HMGet :: Resp -> Command [Maybe a]
- Data.Redis.Command: HMSet :: Resp -> Command ()
- Data.Redis.Command: HScan :: Resp -> Command (Cursor, [a])
- Data.Redis.Command: HSet :: Resp -> Command Bool
- Data.Redis.Command: HSetNx :: Resp -> Command Bool
- Data.Redis.Command: HVals :: Resp -> Command [a]
- Data.Redis.Command: Incr :: Resp -> Command Int64
- Data.Redis.Command: IncrBy :: Resp -> Command Int64
- Data.Redis.Command: IncrByFloat :: Resp -> Command Double
- Data.Redis.Command: Keys :: Resp -> Command [Key]
- Data.Redis.Command: LIndex :: Resp -> Command (Maybe a)
- Data.Redis.Command: LInsert :: Resp -> Command Int64
- Data.Redis.Command: LLen :: Resp -> Command Int64
- Data.Redis.Command: LPop :: Resp -> Command (Maybe a)
- Data.Redis.Command: LPush :: Resp -> Command Int64
- Data.Redis.Command: LPushX :: Resp -> Command Int64
- Data.Redis.Command: LRange :: Resp -> Command [a]
- Data.Redis.Command: LRem :: Resp -> Command Int64
- Data.Redis.Command: LSet :: Resp -> Command ()
- Data.Redis.Command: LTrim :: Resp -> Command ()
- Data.Redis.Command: LastSave :: Resp -> Command Int64
- Data.Redis.Command: MGet :: Resp -> Command [Maybe a]
- Data.Redis.Command: MSet :: Resp -> Command ()
- Data.Redis.Command: MSetNx :: Resp -> Command Bool
- Data.Redis.Command: Multi :: Resp -> Command ()
- Data.Redis.Command: PSubscribe :: Resp -> PubSubCommand ()
- Data.Redis.Command: PUnsubscribe :: Resp -> PubSubCommand ()
- Data.Redis.Command: Persist :: Resp -> Command Bool
- Data.Redis.Command: PfAdd :: Resp -> Command Bool
- Data.Redis.Command: PfCount :: Resp -> Command Int64
- Data.Redis.Command: PfMerge :: Resp -> Command ()
- Data.Redis.Command: Ping :: Resp -> Command ()
- Data.Redis.Command: Publish :: Resp -> Command Int64
- Data.Redis.Command: Quit :: Resp -> Command ()
- Data.Redis.Command: RPop :: Resp -> Command (Maybe a)
- Data.Redis.Command: RPopLPush :: Resp -> Command (Maybe a)
- Data.Redis.Command: RPush :: Resp -> Command Int64
- Data.Redis.Command: RPushX :: Resp -> Command Int64
- Data.Redis.Command: RandomKey :: Resp -> Command (Maybe Key)
- Data.Redis.Command: Rename :: Resp -> Command ()
- Data.Redis.Command: RenameNx :: Resp -> Command Bool
- Data.Redis.Command: SAdd :: Resp -> Command Int64
- Data.Redis.Command: SCard :: Resp -> Command Int64
- Data.Redis.Command: SDiff :: Resp -> Command [a]
- Data.Redis.Command: SDiffStore :: Resp -> Command Int64
- Data.Redis.Command: SInter :: Resp -> Command [a]
- Data.Redis.Command: SInterStore :: Resp -> Command Int64
- Data.Redis.Command: SIsMember :: Resp -> Command Bool
- Data.Redis.Command: SMembers :: Resp -> Command [a]
- Data.Redis.Command: SMove :: Resp -> Command Bool
- Data.Redis.Command: SPop :: Resp -> Command (Maybe a)
- Data.Redis.Command: SRandMember :: Choose -> Resp -> Command [a]
- Data.Redis.Command: SRem :: Resp -> Command Int64
- Data.Redis.Command: SScan :: Resp -> Command (Cursor, [a])
- Data.Redis.Command: SUnion :: Resp -> Command [a]
- Data.Redis.Command: SUnionStore :: Resp -> Command Int64
- Data.Redis.Command: Save :: Resp -> Command ()
- Data.Redis.Command: Scan :: Resp -> Command (Cursor, [a])
- Data.Redis.Command: Select :: Resp -> Command ()
- Data.Redis.Command: Set :: Resp -> Command Bool
- Data.Redis.Command: SetBit :: Resp -> Command Int64
- Data.Redis.Command: SetRange :: Resp -> Command Int64
- Data.Redis.Command: Sort :: Resp -> Command [a]
- Data.Redis.Command: StrLen :: Resp -> Command Int64
- Data.Redis.Command: Subscribe :: Resp -> PubSubCommand ()
- Data.Redis.Command: Ttl :: Resp -> Command (Maybe TTL)
- Data.Redis.Command: Type :: Resp -> Command (Maybe RedisType)
- Data.Redis.Command: Unsubscribe :: Resp -> PubSubCommand ()
- Data.Redis.Command: Unwatch :: Resp -> Command ()
- Data.Redis.Command: Watch :: Resp -> Command ()
- Data.Redis.Command: ZAdd :: Resp -> Command Int64
- Data.Redis.Command: ZCard :: Resp -> Command Int64
- Data.Redis.Command: ZCount :: Resp -> Command Int64
- Data.Redis.Command: ZIncrBy :: Resp -> Command Double
- Data.Redis.Command: ZInterStore :: Resp -> Command Int64
- Data.Redis.Command: ZLexCount :: Resp -> Command Int64
- Data.Redis.Command: ZRange :: Bool -> Resp -> Command (ScoreList a)
- Data.Redis.Command: ZRangeByLex :: Resp -> Command [a]
- Data.Redis.Command: ZRangeByScore :: Bool -> Resp -> Command (ScoreList a)
- Data.Redis.Command: ZRank :: Resp -> Command (Maybe Int64)
- Data.Redis.Command: ZRem :: Resp -> Command Int64
- Data.Redis.Command: ZRemRangeByLex :: Resp -> Command Int64
- Data.Redis.Command: ZRemRangeByRank :: Resp -> Command Int64
- Data.Redis.Command: ZRemRangeByScore :: Resp -> Command Int64
- Data.Redis.Command: ZRevRange :: Bool -> Resp -> Command (ScoreList a)
- Data.Redis.Command: ZRevRangeByScore :: Bool -> Resp -> Command (ScoreList a)
- Data.Redis.Command: ZRevRank :: Resp -> Command (Maybe Int64)
- Data.Redis.Command: ZScan :: Resp -> Command (Cursor, [a])
- Data.Redis.Command: ZScore :: Resp -> Command (Maybe Double)
- Data.Redis.Command: ZUnionStore :: Resp -> Command Int64
+ Data.Redis.Command: [Append] :: Resp -> Command Int64
+ Data.Redis.Command: [Auth] :: Resp -> Command ()
+ Data.Redis.Command: [BLPop] :: FromByteString a => Int64 -> Resp -> Command (Maybe (Key, a))
+ Data.Redis.Command: [BRPopLPush] :: FromByteString a => Int64 -> Resp -> Command (Maybe a)
+ Data.Redis.Command: [BRPop] :: FromByteString a => Int64 -> Resp -> Command (Maybe (Key, a))
+ Data.Redis.Command: [BgRewriteAOF] :: Resp -> Command ()
+ Data.Redis.Command: [BgSave] :: Resp -> Command ()
+ Data.Redis.Command: [BitAnd] :: Resp -> Command Int64
+ Data.Redis.Command: [BitCount] :: Resp -> Command Int64
+ Data.Redis.Command: [BitNot] :: Resp -> Command Int64
+ Data.Redis.Command: [BitOr] :: Resp -> Command Int64
+ Data.Redis.Command: [BitPos] :: Resp -> Command Int64
+ Data.Redis.Command: [BitXOr] :: Resp -> Command Int64
+ Data.Redis.Command: [DbSize] :: Resp -> Command Int64
+ Data.Redis.Command: [DecrBy] :: Resp -> Command Int64
+ Data.Redis.Command: [Decr] :: Resp -> Command Int64
+ Data.Redis.Command: [Del] :: Resp -> Command Int64
+ Data.Redis.Command: [Discard] :: Resp -> Command ()
+ Data.Redis.Command: [Dump] :: Resp -> Command (Maybe ByteString)
+ Data.Redis.Command: [Echo] :: FromByteString a => Resp -> Command a
+ Data.Redis.Command: [Exec] :: Resp -> Command ()
+ Data.Redis.Command: [Exists] :: Resp -> Command Bool
+ Data.Redis.Command: [ExpireAt] :: Resp -> Command Bool
+ Data.Redis.Command: [Expire] :: Resp -> Command Bool
+ Data.Redis.Command: [FlushAll] :: Resp -> Command ()
+ Data.Redis.Command: [FlushDb] :: Resp -> Command ()
+ Data.Redis.Command: [GetBit] :: Resp -> Command Int64
+ Data.Redis.Command: [GetRange] :: FromByteString a => Resp -> Command a
+ Data.Redis.Command: [GetSet] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [Get] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [HDel] :: Resp -> Command Int64
+ Data.Redis.Command: [HExists] :: Resp -> Command Bool
+ Data.Redis.Command: [HGetAll] :: FromByteString a => Resp -> Command [(Field, a)]
+ Data.Redis.Command: [HGet] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [HIncrByFloat] :: Resp -> Command Double
+ Data.Redis.Command: [HIncrBy] :: Resp -> Command Int64
+ Data.Redis.Command: [HKeys] :: Resp -> Command [Field]
+ Data.Redis.Command: [HLen] :: Resp -> Command Int64
+ Data.Redis.Command: [HMGet] :: FromByteString a => Resp -> Command [Maybe a]
+ Data.Redis.Command: [HMSet] :: Resp -> Command ()
+ Data.Redis.Command: [HScan] :: FromByteString a => Resp -> Command (Cursor, [a])
+ Data.Redis.Command: [HSetNx] :: Resp -> Command Bool
+ Data.Redis.Command: [HSet] :: Resp -> Command Bool
+ Data.Redis.Command: [HVals] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [IncrByFloat] :: Resp -> Command Double
+ Data.Redis.Command: [IncrBy] :: Resp -> Command Int64
+ Data.Redis.Command: [Incr] :: Resp -> Command Int64
+ Data.Redis.Command: [Keys] :: Resp -> Command [Key]
+ Data.Redis.Command: [LIndex] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [LInsert] :: Resp -> Command Int64
+ Data.Redis.Command: [LLen] :: Resp -> Command Int64
+ Data.Redis.Command: [LPop] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [LPushX] :: Resp -> Command Int64
+ Data.Redis.Command: [LPush] :: Resp -> Command Int64
+ Data.Redis.Command: [LRange] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [LRem] :: Resp -> Command Int64
+ Data.Redis.Command: [LSet] :: Resp -> Command ()
+ Data.Redis.Command: [LTrim] :: Resp -> Command ()
+ Data.Redis.Command: [LastSave] :: Resp -> Command Int64
+ Data.Redis.Command: [MGet] :: FromByteString a => Resp -> Command [Maybe a]
+ Data.Redis.Command: [MSetNx] :: Resp -> Command Bool
+ Data.Redis.Command: [MSet] :: Resp -> Command ()
+ Data.Redis.Command: [Multi] :: Resp -> Command ()
+ Data.Redis.Command: [PSubscribe] :: Resp -> PubSubCommand ()
+ Data.Redis.Command: [PUnsubscribe] :: Resp -> PubSubCommand ()
+ Data.Redis.Command: [Persist] :: Resp -> Command Bool
+ Data.Redis.Command: [PfAdd] :: Resp -> Command Bool
+ Data.Redis.Command: [PfCount] :: Resp -> Command Int64
+ Data.Redis.Command: [PfMerge] :: Resp -> Command ()
+ Data.Redis.Command: [Ping] :: Resp -> Command ()
+ Data.Redis.Command: [Publish] :: Resp -> Command Int64
+ Data.Redis.Command: [Quit] :: Resp -> Command ()
+ Data.Redis.Command: [RPopLPush] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [RPop] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [RPushX] :: Resp -> Command Int64
+ Data.Redis.Command: [RPush] :: Resp -> Command Int64
+ Data.Redis.Command: [RandomKey] :: Resp -> Command (Maybe Key)
+ Data.Redis.Command: [RenameNx] :: Resp -> Command Bool
+ Data.Redis.Command: [Rename] :: Resp -> Command ()
+ Data.Redis.Command: [SAdd] :: Resp -> Command Int64
+ Data.Redis.Command: [SCard] :: Resp -> Command Int64
+ Data.Redis.Command: [SDiffStore] :: Resp -> Command Int64
+ Data.Redis.Command: [SDiff] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [SInterStore] :: Resp -> Command Int64
+ Data.Redis.Command: [SInter] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [SIsMember] :: Resp -> Command Bool
+ Data.Redis.Command: [SMembers] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [SMove] :: Resp -> Command Bool
+ Data.Redis.Command: [SPop] :: FromByteString a => Resp -> Command (Maybe a)
+ Data.Redis.Command: [SRandMember] :: FromByteString a => Choose -> Resp -> Command [a]
+ Data.Redis.Command: [SRem] :: Resp -> Command Int64
+ Data.Redis.Command: [SScan] :: FromByteString a => Resp -> Command (Cursor, [a])
+ Data.Redis.Command: [SUnionStore] :: Resp -> Command Int64
+ Data.Redis.Command: [SUnion] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [Save] :: Resp -> Command ()
+ Data.Redis.Command: [Scan] :: FromByteString a => Resp -> Command (Cursor, [a])
+ Data.Redis.Command: [Select] :: Resp -> Command ()
+ Data.Redis.Command: [SetBit] :: Resp -> Command Int64
+ Data.Redis.Command: [SetRange] :: Resp -> Command Int64
+ Data.Redis.Command: [Set] :: Resp -> Command Bool
+ Data.Redis.Command: [Sort] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [StrLen] :: Resp -> Command Int64
+ Data.Redis.Command: [Subscribe] :: Resp -> PubSubCommand ()
+ Data.Redis.Command: [Ttl] :: Resp -> Command (Maybe TTL)
+ Data.Redis.Command: [Type] :: Resp -> Command (Maybe RedisType)
+ Data.Redis.Command: [Unsubscribe] :: Resp -> PubSubCommand ()
+ Data.Redis.Command: [Unwatch] :: Resp -> Command ()
+ Data.Redis.Command: [Watch] :: Resp -> Command ()
+ Data.Redis.Command: [ZAdd] :: Resp -> Command Int64
+ Data.Redis.Command: [ZCard] :: Resp -> Command Int64
+ Data.Redis.Command: [ZCount] :: Resp -> Command Int64
+ Data.Redis.Command: [ZIncrBy] :: Resp -> Command Double
+ Data.Redis.Command: [ZInterStore] :: Resp -> Command Int64
+ Data.Redis.Command: [ZLexCount] :: Resp -> Command Int64
+ Data.Redis.Command: [ZRangeByLex] :: FromByteString a => Resp -> Command [a]
+ Data.Redis.Command: [ZRangeByScore] :: FromByteString a => Bool -> Resp -> Command (ScoreList a)
+ Data.Redis.Command: [ZRange] :: FromByteString a => Bool -> Resp -> Command (ScoreList a)
+ Data.Redis.Command: [ZRank] :: Resp -> Command (Maybe Int64)
+ Data.Redis.Command: [ZRemRangeByLex] :: Resp -> Command Int64
+ Data.Redis.Command: [ZRemRangeByRank] :: Resp -> Command Int64
+ Data.Redis.Command: [ZRemRangeByScore] :: Resp -> Command Int64
+ Data.Redis.Command: [ZRem] :: Resp -> Command Int64
+ Data.Redis.Command: [ZRevRangeByScore] :: FromByteString a => Bool -> Resp -> Command (ScoreList a)
+ Data.Redis.Command: [ZRevRange] :: FromByteString a => Bool -> Resp -> Command (ScoreList a)
+ Data.Redis.Command: [ZRevRank] :: Resp -> Command (Maybe Int64)
+ Data.Redis.Command: [ZScan] :: FromByteString a => Resp -> Command (Cursor, [a])
+ Data.Redis.Command: [ZScore] :: Resp -> Command (Maybe Double)
+ Data.Redis.Command: [ZUnionStore] :: Resp -> Command Int64
+ Data.Redis.Command: instance GHC.Base.Semigroup (Data.Redis.Command.Opts a)
+ Data.Redis.Command: instance GHC.Base.Semigroup Data.Redis.Command.BitEnd
+ Data.Redis.Command: instance GHC.Base.Semigroup Data.Redis.Command.BitStart
- Data.Redis.Command: data NonEmpty a :: * -> *
+ Data.Redis.Command: data NonEmpty a
- Data.Redis.Command: nonEmpty :: [a] -> Maybe (NonEmpty a)
+ Data.Redis.Command: nonEmpty :: () => [a] -> Maybe NonEmpty a
Files
- CHANGELOG.md +6/−0
- README.md +9/−0
- redis-resp.cabal +19/−16
- src/Data/Redis/Command.hs +42/−7
+ CHANGELOG.md view
@@ -0,0 +1,6 @@++## 1.0.0++ * GHC 8.4 compatibility.+ * Drop support for GHC < 8.0.+
+ README.md view
@@ -0,0 +1,9 @@+# REdis Serialisation Protocol (RESP)++This library provides [RESP][1] encoding/decoding functionality and+defines most of the available Redis [commands][2] as a GADT which+enables different interpreter implementations such as [redis-io][3].++[1]: http://redis.io/topics/protocol+[2]: http://redis.io/commands+[3]: https://gitlab.com/twittner/redis-io
redis-resp.cabal view
@@ -1,26 +1,29 @@-name: redis-resp-version: 0.4.0-synopsis: REdis Serialization Protocol (RESP) implementation.-license: MPL-2.0-license-file: LICENSE-author: Toralf Wittner-maintainer: Toralf Wittner <tw@dtex.org>-copyright: (C) 2014 Toralf Wittner-homepage: https://gitlab.com/twittner/redis-resp/-bug-reports: https://gitlab.com/twittner/redis-resp/issues-stability: experimental-category: Data-build-type: Simple-cabal-version: >= 1.10+name: redis-resp+version: 1.0.0+synopsis: REdis Serialization Protocol (RESP) implementation.+license: MPL-2.0+license-file: LICENSE+author: Toralf Wittner+maintainer: Toralf Wittner <tw@dtex.org>, Roman S. Borschel <roman@pkaboo.org>+copyright: (C) 2014 Toralf Wittner+homepage: https://gitlab.com/twittner/redis-resp/+bug-reports: https://gitlab.com/twittner/redis-resp/issues+category: Data+build-type: Simple+cabal-version: >= 1.10 description: REdis Serialization Protocol (RESP) implementation as specified in <http://redis.io/topics/protocol>. .- Additionally most Redis commands are declared as an GADT which+ Most Redis commands are declared as a GADT which enables different interpretations such as <http://hackage.haskell.org/package/redis-io redis-io>. +extra-source-files:+ README.md+ CHANGELOG.md+ source-repository head type: git location: git://gitlab.com/twittner/redis-resp.git@@ -37,7 +40,7 @@ build-depends: attoparsec >= 0.11- , base >= 4.6 && < 5+ , base >= 4.9 && < 5 , bytestring >= 0.10.4 , bytestring-conversion >= 0.2 , containers >= 0.5
src/Data/Redis/Command.hs view
@@ -233,7 +233,6 @@ , NE.nonEmpty ) where -import Control.Applicative import Control.Exception (Exception) import Control.Monad.Operational import Data.ByteString.Builder (int64Dec)@@ -247,8 +246,8 @@ import Data.List.NonEmpty (NonEmpty (..), (<|)) import Data.List.Split (chunksOf) import Data.Maybe (maybeToList)-import Data.Monoid hiding (Sum) import Data.Redis.Resp+import Data.Semigroup (Semigroup, (<>)) import Data.String import Data.Typeable import GHC.TypeLits@@ -523,9 +522,12 @@ -- | Command options data Opts (a :: Symbol) = Opts { len :: !Int, opts :: DList ByteString } +instance Semigroup (Opts a) where+ Opts x a <> Opts y b = Opts (x + y) (a `DL.append` b)+ instance Monoid (Opts a) where mempty = Opts 0 DL.empty- Opts x a `mappend` Opts y b = Opts (x + y) (a `DL.append` b)+ mappend = (<>) none :: Monoid m => m none = mempty@@ -536,13 +538,19 @@ newtype BitStart = BitStart ByteString newtype BitEnd = BitEnd ByteString +instance Semigroup BitStart where+ _ <> b = b+ instance Monoid BitStart where- mempty = BitStart ""- _ `mappend` b = b+ mempty = BitStart ""+ mappend = (<>) +instance Semigroup BitEnd where+ _ <> b = b+ instance Monoid BitEnd where- mempty = BitEnd ""- _ `mappend` b = b+ mempty = BitEnd ""+ mappend = (<>) start :: Int64 -> BitStart start = BitStart . int2bytes@@ -598,6 +606,33 @@ ----------------------------------------------------------------------------- -- Transactions +-- | Note that all commands following 'multi' and until 'exec' are queued by+-- a Redis server. Therefore the result of any such command is not available+-- until the exec command completes. For example, the following is an invalid+-- 'Redis' program:+--+-- @+-- multi+-- x <- hexists \"FOO\" \"BAR\"+-- unless x (void $ hset \"FOO\" \"BAR\" 1)+-- exec+-- @+--+-- This pattern is usually indicative of the desire for a transactional+-- check-and-set operation, which may be achieved instead by the following+-- valid command sequence:+--+-- @+-- watch (\"FOO\" R.:| [])+-- x <- hexists \"FOO\" \"BAR\"+-- multi+-- unless x (void $ hset \"FOO\" \"BAR\" 1)+-- exec+-- @+--+--+-- For more information on Redis transactions and conditional updates,+-- see https://redis.io/topics/transactions. multi :: Monad m => Redis m () multi = singleton $ Multi $ cmd 1 ["MULTI"]