Skip to content

Commit

Permalink
Updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
David Czarnecki committed Jan 6, 2011
1 parent f6311bd commit 1857ccc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.rdoc
Expand Up @@ -19,6 +19,11 @@ Create a new leaderboard or attach to an existing leaderboard named 'highscores'

ruby-1.8.7-p302 > highscore_lb = Leaderboard.new('highscores')
=> #<Leaderboard:0x1018e4250 @page_size=25, @port=6379, @host="localhost", @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.1.10)>, @leaderboard_name="highscores">

If you need to pass in options for Redis, you can do this with the redis_options parameter:

redis_options = {:host => 'localhost', :port => 6379, :password => 'password', :db => 'some_redis_db'}
highscore_lb = Leaderboard.new('highscores', redis_options[:host], redis_options[:port], Leaderboard::DEFAULT_PAGE_SIZE, redis_options))

Add members to your leaderboard:

Expand Down Expand Up @@ -67,6 +72,13 @@ Get rank and score for an arbitrary list of members (e.g. friends):
ruby-1.8.7-p302 > highscore_lb.ranked_in_list(['member_1', 'member_62', 'member_67'], true)
=> [{:rank=>55, :member=>"member_1", :score=>1.0}, {:rank=>33, :member=>"member_62", :score=>62.0}, {:rank=>28, :member=>"member_67", :score=>67.0}]

You can set the page size to something other than the default:

ruby-1.8.7-p302 > highscore_lb.page_size = 5
=> 5
ruby-1.8.7-p302 > highscore_lb
=> #<Leaderboard:0x1018e2130 @leaderboard_name="highscores", @page_size=5, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.1.10)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}>

== Performance Metrics

10 million sequential scores insert:
Expand Down

0 comments on commit 1857ccc

Please sign in to comment.