Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test(server)
- time = Time.now
- 100000.times do
- server.write Digest::MD5.hexdigest(rand.to_s), Digest::MD5.hexdigest(rand.to_s)
- end
- Time.now - time
- end
- desc "speed test"
- task :speedtest => :environment do
- redis = ActiveSupport::Cache::RedisStore.new
- memcached = ActiveSupport::Cache::MemCacheStore.new Memcached::Rails.new
- memcache = ActiveSupport::Cache::MemCacheStore.new
- puts "============== speed test ================"
- puts "RedisStore 100000 sets in #{test(redis)}"
- puts "MemCacheSore memcached 100000 sets in #{test(memcached)}"
- Memcached.new.flush
- puts "MemCacheSore memcache-client 100000 sets in #{test(memcache)}"
- end
Add Comment
Please, Sign In to add comment