-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ugprade finagle-memcached to finagle-memcachedx #266
Conversation
@@ -119,23 +120,27 @@ class MemcacheStore(val client: Client, val ttl: Duration, val flag: Int) | |||
{ | |||
override def withPutTtl(ttl: Duration) = new MemcacheStore(client, ttl, flag) | |||
|
|||
override def get(k: String): Future[Option[ChannelBuffer]] = client.get(k) | |||
override def get(k: String): Future[Option[ChannelBuffer]] = | |||
client.get(k).map(_.map(ChannelBufferBuf.Owned.extract)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like if I pattern matched on the Option here to avoid the allocation of the closure and also for None case (using Future.None)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not hot, I'd prefer to just keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we've seen any regression because of this, but @ianoc might know more. Doesn't hurt to change it I guess.
Reran the two failures observed in Travis build, both succeeded.
|
Would you like me to squash the commits before merge? |
Also collapsed a flatMap and pattern match for readability.
@@ -34,9 +35,16 @@ import com.twitter.bijection.netty.ChannelBufferBijection | |||
*/ | |||
object MemcacheLongStore { | |||
private implicit val cb2ary = ChannelBufferBijection | |||
private implicit val b2ary = new Bijection[Buf, Array[Byte]] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have AbstractBijection
for this. A little clearer than extending the trait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Bijection.scala:
/**
* Abstract class to ease Bijection creation from Java.
*/
abstract class AbstractBijection[A, B] extends Bijection[A, B] {
Doesn't this suggest we should be implementing Bijection directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was originally created for java compatibility yes but we have mixed usage of that in scala as well. nbd though, this can be left as is.
LGTM. Merge when green (or if the two flaky tests pass locally). |
This is green now.. merging |
Ugprade finagle-memcached to finagle-memcachedx
No description provided.