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

Safe HaskellSafe
LanguageHaskell2010

HLRDB.Primitives.Redis

Description

A model for categorizing Redis commands for their particular structures using a GADT.

Synopsis

Documentation

data TrimScheme Source #

List and SSet declarations allow you to provide a TrimScheme. When provided, HLRDB will automatically trim the structure to the desired cardinality whenever data is inserted.

For example, if you set a softCardinality of 100 and a trimProbability of 0.05, whenever a data insertion takes place that could bring the cardinality over 100, there will be a 5% chance that a trim command will also be executed. If you want a hard cardinality (to the extent that Redis provides any guarantees), simply set the probability to 1. If you do not want any automatic trimming, simply do not provide a TrimScheme.

data RedisStructure t a b where Source #

GADT declaring the major Redis data structures. For application-level logic, the simpler type aliases declared below should suffice.

Constructors

RKeyValue :: E Maybe a b -> RedisStructure (BASIC ()) a b 
RKeyValueInteger :: (a -> ByteString) -> (b -> Integer) -> (Integer -> b) -> RedisStructure (BASIC Integer) a b 
RList :: RE a b -> Maybe TrimScheme -> RedisStructure LIST a b 
RHSet :: RE a b -> HSET v -> RedisStructure (HSET v) a b 
RSet :: RE a b -> RedisStructure SET a b 
RSortedSet :: RE a b -> Maybe TrimScheme -> RedisStructure SORTEDSET a b 

type RedisBasic k v = RedisStructure (BASIC ()) k v Source #

Alias for simple key-value storage

type RedisIntegral k v = RedisStructure (BASIC Integer) k v Source #

Alias for simple Integer storage

type RedisList k v = RedisStructure LIST k v Source #

Alias for a Redis List

type RedisHSet k s v = RedisStructure (HSET s) k v Source #

Alias for a Redis HSet

type RedisSet k v = RedisStructure SET k v Source #

Alias for a Redis Set

type RedisSSet k v = RedisStructure SORTEDSET k v Source #

Alias for a Redis SortedSet

data ActionPerformed a where Source #

Many commands in Redis return information about whether items were added/removed or merely updated

data E f a b Source #

General primitive encoding. We need a way to serialize the key, and a way to both serialize and deserialize values.

Constructors

E (a -> ByteString) (b -> f ByteString) (f ByteString -> b) 

type RE a b = E Identity a b Source #

Most structures don't rely on any special context

data BASIC a Source #

Type-level indicator for Redis basic types

data LIST Source #

Type-level indicator for Redis Lists

data HSET k Source #

Type-level indicator for Redis HSets with sub-keys of type k; requires a way to serialize and deserialize sub-keys

Constructors

HSET (k -> ByteString) (ByteString -> k) 

data SET Source #

Type-level indicator for Redis Sets

data SORTEDSET Source #

Type-level indicator for Redis SortedSets

data Creation Source #

Type-level indicator for Creation

data Deletion Source #

Type-level indicator for Deletion