hlrdb-core 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+42/−4 lines, 4 filesdep +timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: time
API changes (from Hackage documentation)
+ HLRDB.Core: del :: (Traversable t, MonadRedis m) => RedisStructure v a b -> t a -> m (ActionPerformed Deletion)
+ HLRDB.Core: expire :: MonadRedis m => RedisStructure v a b -> a -> Integer -> m Bool
+ HLRDB.Core: expireat :: MonadRedis m => RedisStructure v a b -> a -> UTCTime -> m Bool
+ HLRDB.Core: persist :: MonadRedis m => RedisStructure v a b -> a -> m Bool
- HLRDB.Internal: ignore :: (Functor f) => f a -> f ()
+ HLRDB.Internal: ignore :: Functor f => f a -> f ()
- HLRDB.Primitives.Aggregate: type (⟿) a b = T ByteString (Maybe ByteString) a b
+ HLRDB.Primitives.Aggregate: type (~~>) a b = T ByteString (Maybe ByteString) a b
Files
- hlrdb-core.cabal +2/−1
- src/HLRDB/Core.hs +35/−2
- src/HLRDB/Internal.hs +1/−1
- src/HLRDB/Primitives/Aggregate.hs +4/−0
hlrdb-core.cabal view
@@ -1,5 +1,5 @@ name: hlrdb-core-version: 0.1.0.0+version: 0.1.1.0 synopsis: High-level Redis Database Core API description: A library for type-driven interaction with Redis license: MIT@@ -36,6 +36,7 @@ , mtl ^>= 2.2.2 , profunctors ^>= 5.2.2 , random ^>= 1.1+ , time (>=1.6 && <1.9.1) || ^>= 1.9.1 , unordered-containers ^>= 0.2.8.0 hs-source-dirs: src default-language: Haskell2010
src/HLRDB/Core.hs view
@@ -58,6 +58,12 @@ , zcard , zscan + -- * Universal+ , HLRDB.Core.del+ , HLRDB.Core.persist+ , HLRDB.Core.expire+ , HLRDB.Core.expireat+ -- * Re-exports from hedis , Redis , MonadRedis@@ -72,14 +78,41 @@ ) where -import Database.Redis (Redis,MonadRedis,liftRedis,Cursor,cursor0)+import Data.Time+import Data.Time.Clock.POSIX+import Database.Redis (Redis,MonadRedis,liftRedis,Cursor,cursor0,del,persist,expire,expireat) import HLRDB.Primitives.Aggregate import HLRDB.Primitives.Redis-+import HLRDB.Internal import HLRDB.Structures.Basic import HLRDB.Structures.List import HLRDB.Structures.HSet import HLRDB.Structures.Set import HLRDB.Structures.SSet++-- | Delete all data for the given keys in Redis+del :: (Traversable t , MonadRedis m) => RedisStructure v a b -> t a -> m (ActionPerformed Deletion)+del p =+ fmap Deleted+ . fixEmpty' (unwrap . Database.Redis.del) (primKey p)++-- | Discard any pending expirations of this key. Returns True if the key both exists and had a timeout which was removed by the command.+persist :: MonadRedis m => RedisStructure v a b -> a -> m Bool+persist p =+ liftRedis . unwrap . Database.Redis.persist . primKey p++-- | Expire after a given amount of time (in seconds). Returns True if the key existed and a timeout was set.+expire :: MonadRedis m => RedisStructure v a b -> a -> Integer -> m Bool+expire p k =+ liftRedis . unwrap . Database.Redis.expire (primKey p k)++-- | Expire at a given timestamp. Returns True if the key existed and a timeout was set.+expireat :: MonadRedis m => RedisStructure v a b -> a -> UTCTime -> m Bool+expireat p k =+ liftRedis+ . unwrap+ . Database.Redis.expireat (primKey p k)+ . round+ . utcTimeToPOSIXSeconds
src/HLRDB/Internal.hs view
@@ -81,7 +81,7 @@ unwrapDeleted = fmap Deleted . unwrap {-# INLINE ignore #-}-ignore :: (Functor f) => f a -> f ()+ignore :: Functor f => f a -> f () ignore = fmap (const ()) -- Redis does not treat treat zero cases properly, so use this to fix the algebra
src/HLRDB/Primitives/Aggregate.hs view
@@ -4,6 +4,7 @@ ( T(..) , type (⟿)+ , type (~~>) , type Query , aggregatePair , remember@@ -54,6 +55,9 @@ -- | A query using input of type 'a' and yielding an output of type 'b' type (⟿) a b = T ByteString (Maybe ByteString) a b++-- | An ASCII version of ⟿+type (~~>) a b = T ByteString (Maybe ByteString) a b -- | Non-infix alias of ⟿ type Query a b = a ⟿ b