Skip to content
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

Cleanup storehaus-redis #328

Merged
merged 1 commit into from
Oct 7, 2016
Merged

Cleanup storehaus-redis #328

merged 1 commit into from
Oct 7, 2016

Conversation

BenFradet
Copy link
Contributor

No description provided.

@BenFradet
Copy link
Contributor Author

This will be made better once #310 is done.

@@ -45,7 +44,7 @@ class RedisHashStore(val client: Client, ttl: Option[Duration])
extends Store[ChannelBuffer, Map[ChannelBuffer, ChannelBuffer]] {

override def get(k: ChannelBuffer): Future[Option[Map[ChannelBuffer, ChannelBuffer]]] =
client.hGetAll(k).map({ case e if (e.isEmpty) => None case xs => Some(Map(xs:_*)) })
client.hGetAll(k).map { case e if e.isEmpty => None case xs => Some(Map(xs: _*)) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make two lines:

.map {
  case e if e.isEmpty => None
  case xs => Some(Map(xs: _*))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@BenFradet
Copy link
Contributor Author

ping @johnynek 😄

Copy link
Collaborator

@johnynek johnynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I had a comment, but somehow it didn't get submitted. Maybe we don't have to fix it now, but we should file an issue, or maybe you can correct my understanding.

@@ -34,7 +33,8 @@ object RedisSortedSetStore {
*/
class RedisSortedSetStore(client: Client)
extends MergeableStore[ChannelBuffer, Seq[(ChannelBuffer, Double)]] {
def semigroup = implicitly[Semigroup[Seq[(ChannelBuffer, Double)]]]
def semigroup: Semigroup[Seq[(ChannelBuffer, Double)]] =
implicitly[Semigroup[Seq[(ChannelBuffer, Double)]]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the semigroup that redis is doing? I tend to doubt it. Seems like the value is more like Map[ChannelBuffer, Double]. Can we add a test that the semigroup we declare here is consistent with how redis works?

We could do that by comparing .multiMerge here on a big set of items to what we would get from MergeableStore.fromStore and using the semigroup here.

@johnynek johnynek merged commit 854c1b8 into twitter:develop Oct 7, 2016
@johnynek johnynek changed the title Cleaup storehaus-redis Cleanup storehaus-redis Oct 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants