Skip to content

Commit

Permalink
storehaus-memcache: pass ttl for MergableMemcacheStore CAS calls
Browse files Browse the repository at this point in the history
  • Loading branch information
franklin-stripe committed May 12, 2015
1 parent afd96ae commit 2b6cd04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object MemcacheStore {
MergeableMemcacheStore[K, V](client, ttl, flag, retries)(kfn)(inj, implicitly[Semigroup[V]])
}

class MemcacheStore(val client: Client, ttl: Duration, flag: Int)
class MemcacheStore(val client: Client, val ttl: Duration, flag: Int)
extends Store[String, ChannelBuffer]
with WithPutTtl[String, ChannelBuffer, MemcacheStore]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MergeableMemcacheStore[K, V](underlying: MemcacheStore, maxRetries: Int)(k
inj.invert(cbValue) match {
case Success(v) => // attempt cas
val resV = semigroup.plus(v, kv._2)
underlying.client.cas(key, inj.apply(resV), casunique).flatMap { success =>
underlying.client.cas(key, 0, underlying.ttl.fromNow, inj.apply(resV), casunique).flatMap { success =>
success.booleanValue match {
case true => Future.value(Some(v))
case false => doMerge(kv, currentRetry + 1) // retry
Expand Down

0 comments on commit 2b6cd04

Please sign in to comment.