From 7aa60d33eff21ccdaa31ccd5dd64196990bb3dea Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 1 Mar 2024 22:52:43 -0500 Subject: Add test redeem message bus functionality --- fig-frontend/src/Fig/Frontend/DB.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fig-frontend/src/Fig/Frontend') diff --git a/fig-frontend/src/Fig/Frontend/DB.hs b/fig-frontend/src/Fig/Frontend/DB.hs index 5ca8772..bcf00f2 100644 --- a/fig-frontend/src/Fig/Frontend/DB.hs +++ b/fig-frontend/src/Fig/Frontend/DB.hs @@ -44,3 +44,12 @@ sismember c key skey = liftIO $ Redis.runRedis c do Redis.sismember key skey >>= hush >>> \case Just x -> pure x Nothing -> pure False + +lpop :: MonadIO m => Redis.Connection -> ByteString -> m (Maybe ByteString) +lpop c key = liftIO $ Redis.runRedis c do + join . hush <$> Redis.lpop key + +rpush :: MonadIO m => Redis.Connection -> ByteString -> ByteString -> m () +rpush c key val = liftIO $ Redis.runRedis c do + _ <- Redis.rpush key [val] + pure () -- cgit v1.2.3