hlrdb-core-0.1.5.0: High-level Redis Database Core API

Safe HaskellNone
LanguageHaskell2010

HLRDB.Structures.List

Contents

Description

If you've provided a TrimScheme in your structure, adding content (via prepend/append) will trim your list to preserve this, prioritizing newest content - i.e., prepend commands will result in content being trimmed from the end on overflow, and append commands will result in content trimmed from the front on overflow.

Synopsis

Documentation

lrange :: MonadRedis m => RedisList a b -> a -> Integer -> Integer -> m [b] Source #

Retrieve a range of elements. Endpoints are inclusive, just as with Haskell's [ 1 .. 5 ] notation.

lprepend :: (MonadRedis m, Traversable t) => RedisList a b -> a -> t b -> m () Source #

Prepend items to the front of a list

lappend :: (MonadRedis m, Traversable t) => RedisList a b -> a -> t b -> m () Source #

Append items to the end of a list

lpop :: MonadRedis m => RedisList a b -> a -> m (Maybe b) Source #

Remove and return an item from the head of the list.

lrem :: MonadRedis m => RedisList a b -> a -> b -> m () Source #

Remove an item from the list. You should ensure that any Eq instance in Haskell respects the induced equality by your encoding scheme, as Redis will use the latter.

llen :: MonadRedis m => RedisList a b -> a -> m Integer Source #

Retrieve the length of a list.

Other commands

The following commands are available in Redis, but are recommended to use only with caution, due to their behavior being either "unhaskell-ey" or downright exotic.

rpop :: MonadRedis m => RedisList a b -> a -> m (Maybe b) Source #

Remove and return an item from the end of the list.

rpoplpush :: MonadRedis m => RedisList a b -> a -> a -> m (Maybe b) Source #

Remove and return an item from the first list and prepend it to the second list.

blpop :: (MonadRedis m, Traversable t) => RedisList a b -> t a -> Integer -> m (Maybe (a, b)) Source #

Pop the first available value from a set of lists; if none is available, block the connection (!) until either the specified timeout completes, returning nothing, or until a value becomes available, returning the value and the key of the list in which it was added, whichever happens first. If multiple clients are waiting for an item from the same list, the one who has been waiting the longest will be given the item. If no keys are given, the command returns immediately with Nothing.

brpop :: (MonadRedis m, Traversable t) => RedisList a b -> t a -> Integer -> m (Maybe (a, b)) Source #

Similar to blpop, but popping from the right.

brpoplpush :: MonadRedis m => RedisList a b -> a -> a -> Integer -> m (Maybe b) Source #

Blocking variant of rpoplpush