7q^:      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789 None5:Low-level representation of replies from the Redis server. :;<=>?@ABCDEFG :> :;<=>?@ABCDEFGNone!"0 HConnection socket-handle.I!Reply thunks for unsent requests.JKReply thunks for requests "in the pipeline". Refers to the same list as I, but can have an offset.KDNumber of pending replies and thus the difference length between I and J<. length connPending - pendingCount = length connRepliesLOWrite the request to the socket output buffer, without actually sending. The M is N!ed when reading replies from the H.O3Take a reply-thunk from the list of future replies.P6Flush the socket. Normally, the socket is flushed in O (actually  conGetReplies{), but for the multithreaded pub/sub code, the sending thread needs to explicitly flush the subscription change requests.Q2Send a request and receive the corresponding replyRA list of all future  s of the S.CThe spine of the list can be evaluated without forcing the replies.Evaluating/forcing a  from the list will T$ the reading and parsing from the Hn. To ensure correct ordering, each Reply first evaluates (and thus reads from the network) the previous one.TF only evaluates it's result once, making this function thread-safe. M@ as implemented by GHC is also threadsafe, it is safe to call N8 here. The list constructor '(:)' must be called from within: unsafeInterleaveIO, to keep the replies in correct order. SUHIJKVWLOPQRXYZ SVWLOPQ  SUHIJKVWLOPQRXYZNone59; [\]^_`abcdefghijk [\ [\]^_`abcdefghijkNone !"9;<=?I.Information for connnecting to a Redis server.!It is recommended to not use the ) data constructor directly. Instead use + and update it with record syntax. For example to connect to a password protected Redis server running on localhost and listening to the default port: ^myConnectInfo :: ConnectInfo myConnectInfo = defaultConnectInfo {connectAuth = Just "secret"} 0When the server is protected by a password, set  to l@ the password. Each connection will then authenticate by the - command.Each connection will .# the database with the given index. RMaximum number of connections to keep open. The smallest acceptable value is 1.!tAmount of time for which an unused connection is kept open. The smallest acceptable value is 0.5 seconds. If the timeoutK value in your redis.conf file is non-zero, it should be larger than !."FA threadsafe pool of network connections to a Redis server. Use the , function to create one.%:This class captures the following behaviour: In a context mG, a command will return it's result wrapped in a "container" of type f.XPlease refer to the Command Type Signatures section of this page for more information.&EContext for normal command execution, outside of transactions. Use ' to run actions of this type..In this context, each result is wrapped in an m8 to account for the possibility of Redis returning an  reply.'7Interact with a Redis datastore specified by the given ". Each call of '% takes a network connection from the " pool and runs the given & action. Calls to 'A may thus block while all connections from the pool are in use.(Deconstruct Redis constructor.( and )= can be used to define instances for arbitrary typeclasses.~WARNING! These functions are considered internal and no guarantee is given at this point that they will not break in future.)Reconstruct Redis constructor.nInternal version of ' that does not depend on the "= abstraction. Used to run the AUTH command when connecting.** can be used to implement commands from experimental versions of Redis. An example of how to implement a command is given below. <-- |Redis DEBUG OBJECT command debugObject :: ByteString -> & (Either  ByteString) debugObject key = * ["DEBUG", "OBJECT", key] +#Default information for connecting: ` connectHost = "localhost" connectPort = PortNumber 6379 -- Redis default port connectAuth = Nothing -- No password connectDatabase = 0 -- SELECT database 0 connectMaxConnections = 50 -- Up to 50 connections connectMaxIdleTime = 30 -- Keep open for 30 seconds ,Opens a "- to a Redis server designated by the given ." !"o#$%pqrst&u'()nvwx*+,-password.indexyz !"o#$%p&'()wx*+,-. !"o#$%pqrst&u'()nvwx*+,-.yzNone!": FOptions for the  command.QOptions for the u command.X A single entry from the slowlog.Z9A unique progressive identifier for every slow log entry.[=The unix timestamp at which the logged command was processed.\=The amount of time needed for its execution, in microseconds.]The command and it's arguments.sRedis default Q1. Equivalent to omitting all optional parameters.  SortOpts { sortBy = Nothing -- omit the BY option , sortLimit = (0,-1) -- return entire collection , sortGet = [] -- omit the GET option , sortOrder = Asc -- sort in ascending order , sortAlpha = False -- sort numerically, not lexicographically } Redis default F1. Equivalent to omitting all optional parameters. MigrateOpts { migrateCopy = False -- remove the key from the local instance , migrateReplace = False -- don't replace existing key on the remote instance } Redis default :1. Equivalent to omitting all optional parameters.  ZaddOpts { zaddCondition = Nothing -- omit NX and XX options , zaddChange = False -- don't modify the return value from the number of new elements added, to the total number of elements changed , zaddIncrement = False -- don't add like ZINCRBY } Redis default 41. Equivalent to omitting all optional parameters. ScanOpts { scanMatch = Nothing -- don't match any pattern , scanCount = Nothing -- don't set any requirements on number elements returned (works like value COUNT 10) } /012345678{9|}~:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^key_key`keyakeypivotvaluebkeypivotvalueckeydcntefgkeystartstophkeystartstopikeystartstopjkeystartstopkkeyminmaxlkeyminmaxmkeyminmaxoffsetcountnkeyminmaxoffsetcountokeymaxminpkeymaxminqkeymaxminoffsetcountrkeymaxminoffsetcountstkey destinationukeykey destinationv destinationkeysw destination weighted keysx destinationkeysy destination weighted keyscmd destinationkeysweightszscriptkeysargs{scriptkeysargs|key}keystartend~destkeysrckeysdestkeysrckeysdestkeysrckeysdestkeysrckey operationkeyshostportkey destinationDbtimeouthostport destinationDbtimeoutkeyskey timeToLiveserializedValuekey timeToLiveserializedValuekeyvaluekeyvaluekey scoreMemberkey scoreMemberoptionskeykeycountkeysectionkeynext cursor and valuesnext cursor and valuesmain part of scan commandkeynext cursor and valueskeynext cursor and valueskeynext cursor and valueskeynext cursor and valueskeynext cursor and valueskeynext cursor and valueskeyminmaxkeyminmaxoffsetcount~/012345678{9~|}:;<=>?@ABCDEFGHIJKMLNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Z/012345678{9|}~:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None !"9:;CI[A controller that stores a set of channels, pattern channels, and callbacks. It allows you to manage Pub/Sub subscriptions and pattern subscriptions and alter them at any time throughout the life of your program. You should typically create the controller at the start of your program and then store it through the life of your program, using  and & to update the current subscriptions.QAn action that when executed will unregister the callbacks. It is returned from  or # and typically you would use it in bracket to guarantee that you unsubscribe from channels. For example, if you are using websockets to distribute messages to clients, you could use something such as: websocketConn <- Network.WebSockets.acceptRequest pending let mycallback msg = Network.WebSockets.sendTextData websocketConn msg bracket (addChannelsAndWait ctrl [("hello", mycallback)] []) id $ const $ do {- loop here calling Network.WebSockets.receiveData -}A handler for a message from a psubscribed channel. The callback is passed the channel the message was sent on plus the message content. Similar to M, callbacks are executed synchronously and any exceptions are rethrown from ._A handler for a message from a subscribed channel. The callback is passed the message content.Messages are processed synchronously in the receiving thread, so if the callback takes a long time it will block other callbacks and other messages from being received. If you need to move long-running work to a different thread, we suggest you use v with a reasonable bound, so that if messages are arriving faster than you can process them, you do eventually block.GIf the callback throws an exception, the exception will be thrown from h which will cause the entire Redis connection for all subscriptions to be closed. As long as you call  in a loop you will reconnect to your subscribed channels, but you should probably add an exception handler to each callback to prevent this.A Redis pattern channel nameA Redis channel name'Encapsulates subscription changes. Use , , ,  or 5 to construct a value. Combine values by using the  interface, i.e.  and .While in PubSub mode, we keep track of the number of current subscriptions (as reported by Redis replies) and the number of messages we expect to receive after a SUBSCRIBE or PSUBSCRIBE command. We can safely leave the PubSub mode when both these numbers are zero.Post a message to a channel ( http://redis.io/commands/publish).7Listen for messages published to the given channels ( "http://redis.io/commands/subscribe).<Stop listening for messages posted to the given channels ( $http://redis.io/commands/unsubscribe).JListen for messages published to channels matching the given patterns ( #http://redis.io/commands/psubscribe).OStop listening for messages posted to channels matching the given patterns ( %http://redis.io/commands/punsubscribe).Listens to published messages on subscribed channels and channels matching the subscribed patterns. For documentation on the semantics of Redis Pub/Sub see  http://redis.io/topics/pubsub.wThe given callback function is called for each received message. Subscription changes are triggered by the returned =. To keep subscriptions unchanged, the callback can return .6Example: Subscribe to the "news" channel indefinitely. w pubSub (subscribe ["news"]) $ \msg -> do putStrLn $ "Message from " ++ show (msgChannel msg) return mempty :Example: Receive a single message from the "chat" channel.  pubSub (subscribe ["chat"]) $ \msg -> do putStrLn $ "Message from " ++ show (msgChannel msg) return $ unsubscribe ["chat"] RIt should be noted that Redis Pub/Sub by its nature is asynchronous so returning  does not mean that callback won't be able to receive any further messages. And to guarantee that you won't won't process messages after unsubscription and won't unsubscribe from the same channel more than once you need to use IORef or something similar Create a new {. Note that this does not subscribe to any channels, it just creates the controller. The subscriptions will happen once  is called.(Get the list of current channels in the . WARNING! This might not exactly reflect the subscribed channels in the Redis server, because there is a delay between adding or removing a channel in the H and when Redis receives and processes the subscription change request.0Get the list of current pattern channels in the . WARNING! This might not exactly reflect the subscribed channels in the Redis server, because there is a delay between adding or removing a channel in the H and when Redis receives and processes the subscription change request.Add channels into the , and if there is an active =, send the subscribe and psubscribe commands to Redis. The  function is thread-safe. This function does not wait for Redis to acknowledge that the channels have actually been subscribed; use  for that.MYou can subscribe to the same channel or pattern channel multiple times; the P keeps a list of callbacks and executes each callback in response to a message.The return value is an action H which will unregister the callbacks, which should typically used with bracket.Call R and then wait for Redis to acknowledge that the channels are actually subscribed.hNote that this function waits for all pending subscription change requests, so if you for example call  from multiple threads simultaneously, they all will wait for all pending subscription changes to be acknowledged by Redis (this is due to the fact that we just track the total number of pending change requests sent to Redis and just wait until that count reaches zero).This also correctly waits if the network connection dies during the subscription change. Say that the network connection dies right after we send a subscription change to Redis.  will throw ConnectionLost and ) will continue to wait. Once you recall  with the same , Q will open a new connection, send subscription commands for all channels in the  (which include the ones we are waiting for), and wait for the responses from Redis. Only once we receive the response from Redis that it has subscribed to all channels in  will  unblock and return.Remove channels from the , and if there is an active 0, send the unsubscribe commands to Redis. Note that as soon as this function returns, no more callbacks will be executed even if more messages arrive during the period when we request to unsubscribe from the channel and Redis actually processes the unsubscribe request. This function is thread-safe..If you remove all channels, the connection in J to redis will stay open and waiting for any new channels from a call to 4. If you really want to close the connection, use   or   to kill the thread running .TInternal function to unsubscribe only from those channels matching the given handle.Call  and then wait for all pending subscription change requests to be acknowledged by Redis. This uses the same waiting logic as  . Since  immediately notifies the U to start discarding messages, you likely don't need this function and can just use .Internal thread which listens for messages and executes callbacks. This is the only thread which ever receives data from the underlying connection.Internal thread which sends subscription change requests. This is the only thread which ever sends data on the underlying connection.GOpen a connection to the Redis server, register to all channels in the , and process messages and subscription change requests forever. The only way this will ever exit is if there is an exception from the network code or an unhandled exception in a  or 9. For example, if the network connection to Redis dies,  will throw a ConnectionLost5. When such an exception is thrown, you can recall  with the same ` which will open a new connection and resubscribe to all the channels which are tracked in the .AThe general pattern is therefore during program startup create a  and fork a thread which calls @ in a loop (using an exponential backoff algorithm such as the  )https://hackage.haskell.org/package/retryretryG package to not hammer the Redis server if it does die). For example, umyhandler :: ByteString -> IO () myhandler msg = putStrLn $ unpack $ decodeUtf8 msg onInitialComplete :: IO () onInitialComplete = putStrLn "Redis acknowledged that mychannel is now subscribed" main :: IO () main = do conn <- connect defaultConnectInfo pubSubCtrl <- newPubSubController [("mychannel", myhandler)] [] forkIO $ forever $ pubSubForever conn pubSubCtrl onInitialComplete `catch` (\(e :: SomeException) -> do putStrLn $ "Got error: " ++ show e threadDelay $ 50*1000) -- TODO: use exponential backoff {- elsewhere in your program, use pubSubCtrl to change subscriptions -} At most one active ! can be running against a single ' at any time. If two active calls to  share a single  there will be deadlocks. If you do want to process messages using multiple connections to Redis, you can create more than one 5. For example, create one PubSubController for each  I and then create a Haskell thread bound to each capability each calling  in a loop. This will create one network connection per controller/capability and allow you to register separate channels and callbacks for each controller, spreading the load across the capabilities.NchannelmessagechannelchannelpatternpatternInitial subscriptions.Callback function.the initial subscriptions!the initial pattern subscriptionsthe channels to subscribe to$the channels to pattern subscribe tothe channels to subscribe tothe channels to psubscribe toThe connection poolBThe controller which keeps track of all subscriptions and handlersThis action is executed once Redis acknowledges that all the subscriptions in the controller are now subscribed. You can use this after an exception (such as ConnectionLost7) to signal that all subscriptions are now reactivated.2 None59;<=I  Result of a  transaction.LTransaction completed successfully. The wrapped value corresponds to the  value returned from the  argument action.&Transaction aborted due to an earlier  command.)At least one of the commands returned an  reply.A _ value represents the result of a command inside a transaction. It is a proxy object for the actual? result, which will only be available after returning from a  transaction.( values are composable by utilizing the ,  or  interfaces.7Command-context inside of MULTI/EXEC transactions. Use  to run actions of this type.In the  context, all commands return a ' value. It is a proxy object for the actualH result, which will only be available after finishing the transaction.GWatch the given keys to determine execution of the MULTI/EXEC block ( http://redis.io/commands/watch).Forget about all watched keys ( http://redis.io/commands/unwatch).aRun commands inside a transaction. For documentation on the semantics of Redis transaction see  #http://redis.io/topics/transactions.SInside the transaction block, command functions return their result wrapped in a . The ` result is a proxy object for the actual command's result, which will only be available after EXECing the transaction.Example usage (note how  's ; instance is used to combine the two individual results): Y runRedis conn $ do set "hello" "hello" set "world" "world" helloworld <-  $ do hello <- get "hello" world <- get "world" return $ (,) <$> hello <*> world liftIO (print helloworld) key None:vkeykeyvaluekeyconnectionNamekeymemberkeyminmaxkeyhostportkeyvaluekeykeysource destinationkeytimeoutkey incrementmemberkeykey fieldValuekeykeyvaluekeystartstopkeymemberkeyindexkeyvaluekeyfieldsource destinationmemberkeymemberkeykeyfieldkey incrementkeyoffsetvaluekey incrementkeykeyminmaxkey destinationkeykey parametervalue numslavestimeoutkeytimeoutkeysecondskeykeybitstartendkey millisecondskeynewkeydestkey sourcekeykeycountvaluekeykeykeystartend destinationkeykeyminmaxscriptkeyvaluekeypattern parameterkeyvalue  keyfieldvalue keyValue keysecondsvalue key millisecondsvaluekeyscript destinationkeykeykeykeyvaluekeyfieldvaluesource destinationtimeoutkeymemberkeyoffsetvaluekeykeyfield incrementkeyfield incrementkeyminmaxkeykeynewkeykeymember keyfield!"#key$keyfield%keystartstop&key decrement'key(keyvalue)key*keyfield+keymillisecondsTimestamp,keystartstop-key.keyindexvalue/key timestamp01keydb2keyoffset3keyValue4 commandName56keytimeout7keymember8message9keymember -./0123456789:;<=>?@ABCDEFGHIJKMLNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789v      !"#$%&'()*+,-./0123456789None:  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKMLNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789<&'()%#$", !+-85./FGHI1^`_+ 84567QRSTUVWsNOPut c *$ 6ab'%.,z{?!94"0XYZ[\]def97:;<=>-JKLMxygh/0123klmnijopqrvw(|}~#&2) 3 E@ABCD *   !"#$%&'(&)*+,-./0123456789:;<=>?@ABCDEEFGHIJJKLMNOOPQRSTTUVWXYZ[\]^^_`abcddefghijklmnopqrstuvwxyz{|}~             !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYWZ[\]^_3W`ab=cdefghijklmnopqrstuvwWxyWz{|b}~7\VHWxWxWxWxWxWxWx    M       "hedis-0.9.2-H9Ii2S982fNLNgq6wIXcaRDatabase.RedisDatabase.Redis.Protocol!Database.Redis.ProtocolPipeliningDatabase.Redis.TypesDatabase.Redis.CoreDatabase.Redis.ManualCommandsDatabase.Redis.PubSubControl.Concurrent killThreadControl.Concurrent.AsynccancelgetNumCapabilitiesDatabase.Redis.TransactionsDatabase.Redis.Commands&network-2.6.3.1-G4Up1CPKbp7DeFsnywOnGGNetwork UnixSocket PortNumberServicePortIDNetwork.SocketHostNameReply SingleLineErrorIntegerBulk MultiBulkConnectionLostExceptionConnectionLost RedisTypeNoneStringHashListSetZSetStatusOkPong RedisResultdecode ConnectInfoConnInfo connectHost connectPort connectAuthconnectDatabaseconnectMaxConnectionsconnectMaxIdleTime Connection MonadRedis liftRedisRedisCtxRedisrunRedisunRedisreRedis sendRequestdefaultConnectInfoconnectauthselectRangeLexInclExclMinrMaxrScanOpts scanMatch scanCountCursor ReplyModeZaddOpts zaddCondition zaddChange zaddIncrement DebugModeSetOpts setSecondssetMilliseconds setCondition Condition MigrateOpts migrateCopymigrateReplace AggregateSumMinMax SortOrderAscDescSortOptssortBy sortLimitsortGet sortOrder sortAlphaSlowlog slowlogIdslowlogTimestamp slowlogMicros slowlogCmdobjectRefcountobjectIdletimeobjectEncoding linsertBefore linsertAftergetType slowlogGet slowlogLen slowlogResetzrangezrangeWithscores zrevrangezrevrangeWithscores zrangebyscorezrangebyscoreWithscoreszrangebyscoreLimitzrangebyscoreWithscoresLimitzrevrangebyscorezrevrangebyscoreWithscoreszrevrangebyscoreLimitzrevrangebyscoreWithscoresLimitdefaultSortOpts sortStoresort zunionstorezunionstoreWeights zinterstorezinterstoreWeightsevalevalshabitcount bitcountRangebitopAndbitopOrbitopXorbitopNotmigratedefaultMigrateOptsmigrateMultiplerestorerestoreReplacesetsetOpts scriptDebugzadddefaultZaddOptszaddOpts clientReply srandmember srandmemberNspopinfo infoSectionexistscursor0scandefaultScanOptsscanOptssscan sscanOptshscan hscanOptszscan zscanOpts zrangebylexzrangebylexLimitPubSubControllerUnregisterCallbacksActionPMessageCallbackMessageCallback RedisPChannel RedisChannelMessagePMessage msgChannel msgMessage msgPatternPubSubpublish subscribe unsubscribe psubscribe punsubscribepubSubnewPubSubControllercurrentChannelscurrentPChannels addChannelsaddChannelsAndWaitremoveChannelsremoveChannelsAndWait pubSubForeverTxResult TxSuccess TxAbortedTxErrorQueuedRedisTxwatchunwatch multiExecttlsetnxpttl commandCount clientSetnamezrankzremrangebyscorehkeysslaveofrpushx debugObjectbgsavehlen rpoplpushbrpop bgrewriteaofzincrbyhgetallhmsetsinterpfaddzremrangebyrankflushdbsaddlindexlpushhstrlensmovezscoreconfigResetstatpfcounthdel incrbyfloatsetbitflushallincrbytimesmembers zlexcountsunion sinterstorepinghvals configSet scriptFlushdbsizewaitlpop clientPauseexpiremgetbitposlastsavepexpire clientListrenamenxpfmergelremsdiffgetgetrange sdiffstorezcount scriptLoadgetsetdumpkeys configGetrpush randomkeyhsetnxmsetsetexpsetexscard scriptExists sunionstorepersiststrlenlpushxhset brpoplpushzrevrank scriptKillsetrangedel hincrbyfloathincrbyzremrangebylexrpoprenamezremhexists clientGetname configRewritedecrhmgetlrangedecrbyllenappendincrhget pexpireatltrimzcardlsetexpireatsavemovegetbitmsetnx commandInfoquitblpopsremecho sismember renderRequest renderArgshowBScrlfreplystringerrorintegerbulkmultiintegrallineeol $fNFDataReply connHandle connReplies connPendingconnPendingCntsendbaseGHC.IO.Handle.TypesHandle GHC.IO.HandlehFlushrecvflushrequestconnGetReplies GHC.IO.UnsafeunsafeInterleaveIOConn disconnectioErrorToConnLost errConnClosed"$fExceptionConnectionLostExceptionRedisArgencode$fRedisResult[]$fRedisResult(,)$fRedisResult[]0$fRedisResultMaybe$fRedisResultBool$fRedisResultRedisType$fRedisResultStatus$fRedisResultDouble$fRedisResultInteger$fRedisResultByteString$fRedisResultReply$fNFDataStatus$fRedisArgDouble$fRedisArgInteger$fRedisArgByteStringGHC.BaseJust Data.EitherEitherrunRedisInternal returnDecodeRedisEnvEnvenvConn envLastReply setLastReply$fMonadRedisRedis$fRedisCtxRedisEitherOnOffSkipYesSyncNoNxXx sortInternalzstoreInternalbitop addScanOpts$fRedisArgRangeLex$fRedisResultCursor$fRedisArgCursor$fRedisArgReplyMode$fRedisArgDebugMode$fRedisArgCondition$fRedisResultSlowlog"stm-2.4.4.1-4z2NRWnB0NIIUvSJsHW0kFControl.Concurrent.STM.TBQueueTBQueuememptyMonoidmappendmconcat PubSubState unsubChannels listenThread sendThread callbacks pcallbacks sendChanges pendingCntlastUsedCallbackIdUnregisterHandle PubSubReply Subscribed UnsubscribedMsgCommandredisCmd updatePendingCmd DoNothingchangessubsunsubspsubspunsubsPatternChannel Unsubscribe SubscribesubCntpending modifyPending putSubCntsendCmdcmdCounttotalPendingChanges rawSendCmd plusChangeCnt decodeMsgerrMsg $fCommandCmd $fCommandCmd0 $fCommandCmd1 $fCommandCmd2 $fMonoidCmd $fMonoidCmd0$fMonoidPubSubFunctor ApplicativeMonad runRedisTxexec$fNFDataTxResult $fMonadQueued$fApplicativeQueued$fFunctorQueued$fRedisCtxRedisTxQueued$fMonadRedisRedisTx