module Database.Redis.String
    ( itemSet
    , itemSetB
    , itemGet
    , itemGetB
    ) where


import           System.IO

import           Database.Redis.Internal


------------------------------------------------------------------------------
-- SET
itemSet :: Handle
        -> String                -- ^ key to set
        -> String                -- ^ value to set
        -> IO (Maybe RedisReply)
itemSet h key value = request h $ map toUTF8 ["SET", key, value]


-- SET for ByteString input
itemSetB :: Handle
         -> ByteString            -- ^ key to set
         -> ByteString            -- ^ value to set
         -> IO (Maybe RedisReply)
itemSetB h key value = request h [toUTF8 "SET", key, value]


------------------------------------------------------------------------------
-- GET
itemGet :: Handle
        -> String                -- ^ key of the value to return
        -> IO (Maybe RedisReply)
itemGet h key = request h $ map toUTF8 ["GET", key]

-- GET for ByteString input
itemGetB :: Handle
         -> ByteString            -- ^ key of the value to return
         -> IO (Maybe RedisReply)
itemGetB h key = request h [toUTF8 "GET", key]

-- GETSET
-- MGET
-- SETNX
-- SETEX
-- MSET
-- MSETNX
-- INCR
-- INCRBY
-- DECR
-- DECRBY
-- APPEND
-- SUBSTR