Skip to content

Commit

Permalink
Add examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmd committed Nov 14, 2015
1 parent 0ab8e06 commit 12c1d9b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ Or install it yourself as:
```ruby
require 'collectr/redis/redis_hash'
x = Collectr::RedisHash.new('example')
x.clear # in case 'example' hash was stored previously
x[3] = 7
x[3]
=> 7
x.fetch(3) { 88 }
=> 7
x.fetch(:not_found) { 88 }
=> 88
x[:not_found] # fetch doesn't store default
=> nil
x.cache(:not_found) { 99 }
=> 99
x[:not_found] # cache does store default
=> 99
```

```ruby
Expand Down

0 comments on commit 12c1d9b

Please sign in to comment.