Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support a group key for storing storing a group of values on a single server #176

Closed
bpot opened this Issue · 2 comments

2 participants

@bpot

It would be nice if you could tell dalli to choose a server to choose a server to store/fetch values based on a group-key (user_id, etc).

I'm interested in implementing this but unsure if what the best API would be.

We could add an option to every get/fetch command:

dalli.set('abc',123, :hash_by => user.id)

Or use a block:

 dalli.group_by(user.id) do
   dalli.set('abc',123)
 end

I'm partial to the block format. It seems less repetitive and seems less invasive than making all the operations support a new parameter.

Thoughts?

@mperham
Owner

This would be trivial to support with the block format and a Thread local variable. Pull requests accepted. :beer:

@mperham
Owner

I would think writing a memcached "sharding" layer on top of Dalli would be relatively straightforward. It's not something that should go into dalli proper though.

@mperham mperham closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.