Skip to content

Instantly share code, notes, and snippets.

@r38y
Created April 28, 2009 02:01
Show Gist options
  • Save r38y/102884 to your computer and use it in GitHub Desktop.
Save r38y/102884 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'redis'
require 'base62'
r = Redis.new
start_time = Time.now
10.times do |i|
r.incr('url_count')
url_count = r['url_count'].to_i
puts url_count.class.name # returns Float... huh?
puts "URL Count: #{r['url_count']}"
key = url_count.base62_encode
puts "URL Key: #{key}"
r[key] = 'http://google.com'
end
puts "Took #{Time.now - start_time} seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment