Skip to content

Conversation

@jeremy
Copy link
Contributor

@jeremy jeremy commented Apr 13, 2017

Upstreaming a patch we use to support distributed cache lookups. Map the keys to their nodes, mget them on each node, and stitch the results together.

Apparently this component is frozen and unmaintained. That's a shame, considering caching is a common use case for Redis, and will become more so with upcoming support for LFU expiry. Sharing for posterity, in any case.

Related: #673, #554, #478, #12.

def mapped_mget(*keys)
raise CannotDistribute, :mapped_mget
results = {}
keys.group_by { |k| node_for k }.each do |node, subkeys|
Copy link

@tubbo tubbo Jun 23, 2017

Choose a reason for hiding this comment

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

this could also be each_with_object({}) do |results, (node, subkeys)|.

Map the keys to their nodes, mget them on each node, and stitch the
results together.
@jeremy jeremy force-pushed the distributed-mget branch from 3122b5e to 2e46039 Compare June 23, 2017 18:19
@tubbo
Copy link

tubbo commented Jul 10, 2017

redis-store is waiting to merge redis-store/redis-store#282 until this one gets into redis.rb.

@jeremy
Copy link
Contributor Author

jeremy commented Jul 10, 2017

redis-store/redis-store#282 😊

@djanowski djanowski merged commit 5224ad4 into redis:master Aug 25, 2017
djanowski added a commit that referenced this pull request Aug 25, 2017
@djanowski
Copy link
Collaborator

Should be out soon in the form of ~4.0.1.

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.

3 participants