newtoy/adapter — Issue #5: Support for batched calls?
Author: technoweenie
Created: 2011-12-30 23:13:54+00:00
State: open

I'm wondering if you'd consider adding support for batched calls for `#read`/`#write`/`#delete`?

```ruby
adapter.write_all 1 => 'one', 2 => 'two'

# values come back in the same order of the given IDs
values = adapter.read_all(1,2,3)

adapter.delete_all 1, 2, 3
```

I think these can be implemented in a way that keeps backwards compatibility, and lets the adapter gems optimize as necessary. Some examples:

* A lot of k/v stores have some multi-get functionality (memcache, redis, mongo, cassandra).
* Redis' DEL command allows multiple keys for an efficient batch delete operation.
* Redis pipelining and LevelDB batching allow efficient batch writes/deletes.

Let me know if you think this is a good idea or not. I'll be adding it most likely anyway, and will file pull requests when ready.