Skip to content

Instantly share code, notes, and snippets.

@flazz
Created July 7, 2011 15:38
Show Gist options
  • Save flazz/1069781 to your computer and use it in GitHub Desktop.
Save flazz/1069781 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'riak'
require 'json'
require 'benchmark'
require 'pp'
$client = Riak::Client.new :protocol => :pbc
def count_all_keys
mr = Riak::MapReduce.new($client).
add("events").
map("function(v) { return [1]; }").
reduce("Riak.reduceSum", :keep => true)
results = mr.run
p results
puts
end
puts Benchmark.measure { count_all_keys }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment