Safe Haskell | None |
---|---|
Language | Haskell2010 |
SortedSets, like lists, support automatic cardinality management when provided a TrimScheme
.
HLRDB exports a more opinionated and less easy-to-make-mistakes API than Redis supports. Scores are golf-(or race) style, where lower numbers are better. The API is setup to make retrieving the best items and discarding the worst items natural, rather than trying to remember which direction the data is sorted in.
You should ensure that your Haskell Eq
instances respect the equality induced by your encoding scheme, i.e., that a == b ~ encode a == encode b
.
- zadd :: (MonadRedis m, Traversable t) => RedisSSet a b -> a -> t (Double, b) -> m (ActionPerformed Creation)
- zscore :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Double)
- zupdate :: MonadRedis m => RedisSSet a b -> a -> (Double -> Double) -> m ()
- zbest :: MonadRedis m => RedisSSet a b -> a -> Integer -> Integer -> m [b]
- zworst :: MonadRedis m => RedisSSet a b -> a -> Integer -> Integer -> m [b]
- zmember :: MonadRedis m => RedisSSet a b -> a -> b -> m Bool
- zrank :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Integer)
- zrevrank :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Integer)
- zrem :: (MonadRedis m, Traversable t) => RedisSSet a b -> a -> t b -> m (ActionPerformed Deletion)
- zincrby :: MonadRedis m => RedisSSet a b -> a -> (Integer, b) -> m Double
- zcard :: MonadRedis m => RedisSSet a b -> a -> m Integer
- zscan :: MonadRedis m => RedisSSet a b -> a -> Cursor -> m (Maybe Cursor, [(b, Double)])
Documentation
zadd :: (MonadRedis m, Traversable t) => RedisSSet a b -> a -> t (Double, b) -> m (ActionPerformed Creation) Source #
Add items and scores
zscore :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Double) Source #
Lookup an element's score
zupdate :: MonadRedis m => RedisSSet a b -> a -> (Double -> Double) -> m () Source #
Read the scores from Redis, apply the given trasformation, and write the resulting data
zbest :: MonadRedis m => RedisSSet a b -> a -> Integer -> Integer -> m [b] Source #
Retrieve the given range of best-performing elements. Range is inclusive, just as with Haskell's [ 1 .. 5 ] notation, and it is 0-based, which means [ 0 .. 4 ] is what corresponds to the English phrase "Best 5."
zworst :: MonadRedis m => RedisSSet a b -> a -> Integer -> Integer -> m [b] Source #
Retrieve the given range of worst-performing elements. Range is inclusive, just as with Haskell's [ 1 .. 5 ] notation, and it is 0-based, which means [ 0 .. 4 ] is what corresponds to the English phrase "Worst 5."
zmember :: MonadRedis m => RedisSSet a b -> a -> b -> m Bool Source #
Test if an object is a member of the set.
zrank :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Integer) Source #
Calculate the rank of an item. The best item has rank 0.
zrevrank :: MonadRedis m => RedisSSet a b -> a -> b -> m (Maybe Integer) Source #
Calculate the rank of an item starting from the end, e.g., the worst item has rank 0.
zrem :: (MonadRedis m, Traversable t) => RedisSSet a b -> a -> t b -> m (ActionPerformed Deletion) Source #
Remove items from a sorted set