README.md in second_level_cache-1.5.1 vs README.md in second_level_cache-1.6.0

- old
+ new

@@ -13,20 +13,20 @@ ## Install In your gem file: ```ruby -gem "second_level_cache", :git => "git://github.com/csdn-dev/second_level_cache.git" +gem "second_level_cache", "~> 1.5" ``` ## Usage For example, cache User objects: ```ruby class User < ActiveRecord::Base - acts_as_cached + acts_as_cached(:version => 1, :expires_in => 1.week) end ``` Then it will fetch cached object in this situations: @@ -35,18 +35,35 @@ User.find_by_id(1) User.find_by_id!(1) User.find_by_id_and_name(1, "Hooopo") User.where(:status => 1).find_by_id(1) user.articles.find_by_id(1) -user.articles.find(1), user.where(:status => 1).find(1) +user.articles.find(1) +User.where(:status => 1).find(1) article.user ``` Cache key: ```ruby user = User.find 1 -user.second_level_cache_key # We will get the key looks like "slc/user/1" +user.second_level_cache_key # We will get the key looks like "slc/user/1/0" +``` + +Disable SecondLevelCache: + +```ruby + User.without_second_level_cache do + user = User.find 1 + # ... + end +``` + +Only `SELECT *` query will be cached: + +```ruby + # this query will NOT be cached + User.select("id, name").find(1) ``` Notice: * SecondLevelCache cache by model name and id, so only find_one query will work.