mperham/dalli — Issue #176: Support a group key for storing storing a group of values on a single server
Author: bpot
Created: 2012-03-03 02:30:13+00:00
State: open

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](http://code.google.com/p/memcached/wiki/NewCommonFeatures#Get-By-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?