packages feed

memcache 0.3.0.1 → 0.3.0.2

raw patch · 4 files changed

+27/−13 lines, 4 files

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@+# 0.3.0.2 - March 27th, 2024++* Make the key hashing algorithm configurable by clients -- that is, let+  clients provide a function mapping a key to a server.+ # 0.3.0.1 - January 17th, 2021 -* Fix cabal file to have correct tag for github+* No changes, needed a new release to fix a Hackage upload issue.  # 0.3.0.0 - January 17th, 2021 
Database/Memcache/Cluster.hs view
@@ -84,7 +84,12 @@         -- it failed.         --         -- Default is 750ms.-        optsServerTimeout :: Milli+        optsServerTimeout :: Milli,+        --+        -- | Figure out which server to talk to for a given key.+        --+        -- Default is 'getServerForKeyDefault'.+        optsGetServerForKey :: Cluster -> Key -> IO (Maybe Server)         -- TODO: socket_timeout         -- TODO: failover         -- TODO: expires_in@@ -93,14 +98,15 @@         -- TODO: compress_min_size         -- TODO: compress_max_size         -- TODO: value_max_bytes-    } deriving (Eq, Show)+    }  instance Default Options where   def = Options {             optsServerRetries  = 2,             optsFailRetryDelay = 200,             optsDeadRetryDelay = 1500,-            optsServerTimeout  = 750+            optsServerTimeout  = 750,+            optsGetServerForKey = getServerForKeyDefault         }  -- | Memcached cluster.@@ -112,8 +118,9 @@         cRetries   :: {-# UNPACK #-} !Int,         cFailDelay :: {-# UNPACK #-} !Int, -- ^ microseconds         cDeadDelay :: !NominalDiffTime,-        cTimeout   :: {-# UNPACK #-} !Int -- ^ microseconds-    } deriving (Eq, Show)+        cTimeout   :: {-# UNPACK #-} !Int, -- ^ microseconds+        cGetServerForKey  :: Cluster -> Key -> IO (Maybe Server)+    }  -- | Establish a new connection to a group of Memcached servers. newCluster :: [ServerSpec] -> Options -> IO Cluster@@ -126,7 +133,8 @@             cRetries   = optsServerRetries ,             cFailDelay = fromEnum optsFailRetryDelay,             cDeadDelay = fromRational $ toRational optsDeadRetryDelay / 1000,-            cTimeout   = fromEnum optsServerTimeout +            cTimeout   = fromEnum optsServerTimeout,+            cGetServerForKey = optsGetServerForKey         }  -- | Check if server is alive.@@ -146,9 +154,9 @@  -- | Figure out which server to talk to for this key. I.e., the distribution -- method. We use consistent hashing based on the CHORD approach.-getServerForKey :: Cluster -> Key -> IO (Maybe Server)-{-# INLINE getServerForKey #-}-getServerForKey c k = do+getServerForKeyDefault :: Cluster -> Key -> IO (Maybe Server)+{-# INLINE getServerForKeyDefault #-}+getServerForKeyDefault  c k = do     let hashedKey = hash k         searchF s = sid s < hashedKey     servers' <- V.filterM (serverAlive $ cDeadDelay c) $ cServers c@@ -167,7 +175,7 @@ keyedOp :: Cluster -> Key -> Request -> IO Response {-# INLINE keyedOp #-} keyedOp c k req = do-    s' <- getServerForKey c k+    s' <- cGetServerForKey c c k     case s' of         Just s  -> serverOp c s req         Nothing -> throwIO $ ClientError NoServersReady
README.md view
@@ -76,4 +76,5 @@  * Alfredo Di Napoli (<alfredo.dinapoli@gmail.com>) * Amit Levy+* Steven Leiva 
memcache.cabal view
@@ -1,5 +1,5 @@ name:           memcache-version:        0.3.0.1+version:        0.3.0.2 homepage:       https://github.com/dterei/memcache-hs bug-reports:    https://github.com/dterei/memcache-hs/issues synopsis:       A memcached client library.@@ -42,7 +42,7 @@ Source-repository this   type: git   location: https://github.com/dterei/memcache-hs.git-  tag: 0.3.0.1+  tag: 0.3.0.2  source-repository head   type:     git