Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A model for categorizing Redis commands for their particular structures using a GADT.
Synopsis
- data TrimScheme = TrimScheme {}
- data RedisStructure t a b where
- 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
- type RedisIntegral k v = RedisStructure (BASIC Integer) k v
- type RedisList k v = RedisStructure LIST k v
- type RedisHSet k s v = RedisStructure (HSET s) k v
- type RedisSet k v = RedisStructure SET k v
- type RedisSSet k v = RedisStructure SORTEDSET k v
- data ActionPerformed a where
- data E f a b = E (a -> ByteString) (b -> f ByteString) (f ByteString -> b)
- type RE a b = E Identity a b
- data BASIC a
- data LIST
- data HSET k = HSET (k -> ByteString) (ByteString -> k)
- data SET
- data SORTEDSET
- data Creation
- data Deletion
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.
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
General primitive encoding. We need a way to serialize the key, and a way to both serialize and deserialize values.
E (a -> ByteString) (b -> f ByteString) (f ByteString -> b) |
Type-level indicator for Redis HSets with sub-keys of type k; requires a way to serialize and deserialize sub-keys
HSET (k -> ByteString) (ByteString -> k) |