Skip to content

Commit

Permalink
Removed superfluous specs. Documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Guidi committed Jul 17, 2010
1 parent 3688fd2 commit 0fd67cf
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 12 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ Install the gem

sudo gem install redis-store

## Options
There are two ways to configure the Redis server options: by an URI string and by an hash.
By default each store try to connect on `localhost` with the port `6379` and the db `0`.

### String

"192.168.1.100:23682/13/theplaylist"

host: 192.168.1.100
port: 23682
db: 13
namespace: theplaylist

If you want to specify the `namespace` optional, you have to pass the `db` param too.

### Hash

{ :host => 192.168.1.100, :port => 23682, :db => 13, :namespace => "theplaylist" }

## Cache store

Provides a cache store for your Ruby web framework of choice.
Expand Down
24 changes: 18 additions & 6 deletions lib/cache/merb/redis_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ class RedisStore < AbstractStore
# Instantiate the store.
#
# Example:
# RedisStore.new # => host: localhost, port: 6379, db: 0
# RedisStore.new :servers => ["example.com"] # => host: example.com, port: 6379, db: 0
# RedisStore.new :servers => ["example.com:23682"] # => host: example.com, port: 23682, db: 0
# RedisStore.new :servers => ["example.com:23682/1"] # => host: example.com, port: 23682, db: 1
# RedisStore.new :servers => ["localhost:6379/0", "localhost:6380/0"] # => instantiate a cluster
def initialize(config = {})
# RedisStore.new
# # => host: localhost, port: 6379, db: 0
#
# RedisStore.new :servers => ["example.com"]
# # => host: example.com, port: 6379, db: 0
#
# RedisStore.new :servers => ["example.com:23682"]
# # => host: example.com, port: 23682, db: 0
#
# RedisStore.new :servers => ["example.com:23682/1"]
# # => host: example.com, port: 23682, db: 1
#
# RedisStore.new :servers => ["example.com:23682/1/theplaylist"]
# # => host: example.com, port: 23682, db: 1, namespace: theplaylist
#
# RedisStore.new :servers => ["localhost:6379/0", "localhost:6380/0"]
# # => instantiate a cluster
def initialize(config = { })
@data = Redis::Factory.create config[:servers]
end

Expand Down
22 changes: 17 additions & 5 deletions lib/cache/sinatra/redis_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@ class RedisStore
# Instantiate the store.
#
# Example:
# RedisStore.new # => host: localhost, port: 6379, db: 0
# RedisStore.new "example.com" # => host: example.com, port: 6379, db: 0
# RedisStore.new "example.com:23682" # => host: example.com, port: 23682, db: 0
# RedisStore.new "example.com:23682/1" # => host: example.com, port: 23682, db: 1
# RedisStore.new "localhost:6379/0", "localhost:6380/0" # => instantiate a cluster
# RedisStore.new
# # => host: localhost, port: 6379, db: 0
#
# RedisStore.new "example.com"
# # => host: example.com, port: 6379, db: 0
#
# RedisStore.new "example.com:23682"
# # => host: example.com, port: 23682, db: 0
#
# RedisStore.new "example.com:23682/1"
# # => host: example.com, port: 23682, db: 1
#
# RedisStore.new "example.com:23682/1/theplaylist"
# # => host: example.com, port: 23682, db: 1, namespace: theplaylist
#
# RedisStore.new "localhost:6379/0", "localhost:6380/0"
# # => instantiate a cluster
def initialize(*addresses)
@data = Redis::Factory.create addresses
end
Expand Down
1 change: 0 additions & 1 deletion spec/active_support/cache/redis_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ module Cache
@store.read("rabbit")
end


if ::RedisStore.rails3?
# it "should write the data"
# it "should write the data" do
Expand Down

0 comments on commit 0fd67cf

Please sign in to comment.