Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hooopo committed Dec 19, 2012
1 parent 2b8f342 commit 652e944
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -100,5 +100,13 @@ class User < ActiveRecord::Base
acts_as_cached(:version => 2, :expires_in => 1.week)
end
```
* It provides a great feature, not hits db when fetching record via unique key(not premery key).
```ruby
# this will fetch from cache
user = User.fetch_by_uniq_key("hooopo", :nick_name)

# this also fetch from cache
user = User.fetch_by_uniq_key!("hooopo", :nick_name) # this will raise `ActiveRecord::RecordNotFound` Exception when nick name not exists.
```


0 comments on commit 652e944

Please sign in to comment.