README.md in second_level_cache-2.1.8 vs README.md in second_level_cache-2.1.9

- old
+ new

@@ -1,11 +1,11 @@ # SecondLevelCache -[![Gem Version](https://badge.fury.io/rb/second_level_cache.png)](http://badge.fury.io/rb/second_level_cache) -[![Dependency Status](https://gemnasium.com/hooopo/second_level_cache.png)](https://gemnasium.com/hooopo/second_level_cache) -[![Build Status](https://travis-ci.org/hooopo/second_level_cache.png?branch=master)](https://travis-ci.org/hooopo/second_level_cache) -[![Code Climate](https://codeclimate.com/github/hooopo/second_level_cache.png)](https://codeclimate.com/github/hooopo/second_level_cache) +[![Gem Version](https://badge.fury.io/rb/second_level_cache.svg)](http://badge.fury.io/rb/second_level_cache) +[![Dependency Status](https://gemnasium.com/hooopo/second_level_cache.svg)](https://gemnasium.com/hooopo/second_level_cache) +[![Build Status](https://travis-ci.org/hooopo/second_level_cache.svg?branch=master)](https://travis-ci.org/hooopo/second_level_cache) +[![Code Climate](https://codeclimate.com/github/hooopo/second_level_cache.svg)](https://codeclimate.com/github/hooopo/second_level_cache) SecondLevelCache is a write-through and read-through caching library inspired by Cache Money and cache_fu, support ActiveRecord 4. Read-Through: Queries by ID, like `current_user.articles.find(params[:id])`, will first look in cache store and then look in the database for the results of that query. If there is a cache miss, it will populate the cache. @@ -15,11 +15,11 @@ ## Install In your gem file: ```ruby -gem "second_level_cache", "~> 2.1.8" +gem "second_level_cache", "~> 2.1.9" ``` For ActiveRecord 3: ```ruby @@ -89,17 +89,17 @@ # user and account's write_second_level_cache operation will invoke after the logger. ActiveRecord::Base.transaction do user.save account.save Rails.logger.info "info" -end # <- Cache write +end # <- Cache write # if you want to do something after user and account's write_second_level_cache operation, do this way: ActiveRecord::Base.transaction do user.save account.save -end # <- Cache write +end # <- Cache write Rails.logger.info "info" ``` * If you are using SecondLevelCache with database_cleaner, you should set cleaning strategy to `:truncation`: @@ -112,11 +112,11 @@ In production env, we recommend to use [Dalli](https://github.com/mperham/dalli) as Rails cache store. ```ruby config.cache_store = [:dalli_store, APP_CONFIG["memcached_host"], {:namespace => "ns", :compress => true}] ``` -## Tips: +## Tips: * When you want to clear only second level cache apart from other cache for example fragment cache in cache store, you can only change the `cache_key_prefix`: ```ruby @@ -128,10 +128,10 @@ 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 primary key). +* It provides a great feature, not hits db when fetching record via unique key(not primary key). ```ruby # this will fetch from cache user = User.fetch_by_uniq_keys(nick_name: "hooopo") post = Post.fetch_by_uniq_keys(user_id: 2, slug: "foo")