README.md in bitzer_store-0.0.2 vs README.md in bitzer_store-0.0.3
- old
+ new
@@ -1,14 +1,10 @@
# BitzerStore
-BitzerStore can treat individual cache clusters in Rails.
-Rails cache normally uses one cache cluster.
+The cache of Rails uses the cache cluster only one.
+BitzerStore can treat multiple cache clusters.
- config.cache_store = :mem_cache_store, "server1", "server2"
-
-BitzerStore can use several named cache cluster.
-
## Installation
Add this line to your application's Gemfile:
gem 'bitzer_store'
@@ -22,31 +18,69 @@
$ gem install bitzer_store
## Usage
1.config
-at config/environments/*.rb
+at ```config/environments/*.rb```
- config.cache_store = :bitzer_store, {
- :default => [:mem_cache_store, "server0"],
- :top_page => [:mem_cache_store, "server1", "server2"],
- :obj => [:dalli, "server3"],
- :footer => [:file_store, "/tmp"]
- }
+```ruby
+MyApp::Application.configure do
+ BitzerStore.configure(config) do |cache|
+ cache.default :mem_cache_store, "server0"
+ cache.top_page :mem_cache_store, "server1", "server2"
+ cache.obj :dalli, "server3"
+ cache.footer :file_store, "/tmp"
+ end
+end
+```
-Each hash key is name of cache cluster.
-You should supply :default key which is used to default cache cluster.
+The ```xxx``` of ```cache.xxx``` is name of cache cluster.
+You should supply ```cache.default``` which is used to cache cluster of default.
+You can specify the setting common items.
+Setting common items will be overwritten with individual setting.
+
+```ruby
+MyApp::Application.configure do
+ BitzerStore.configure(config) do |cache|
+ cache.common_setting :memcache_store, "server0", :expires_in => 600
+ cache.default :namespace => "tsu"
+ cache.top_page :dalli, "server1"
+ end
+end
+```
+
+The contents of the above is the same as below.
+
+```ruby
+MyApp::Application.configure do
+ BitzerStore.configure(config) do |cache|
+ cache.default :memcache_store, "server0", :expires_in => 600, :namespace => "tsu"
+ cache.top_page :dalli, "server1", :expires_in => 600
+ end
+end
+```
+
2.Rails.cache
When specify no name, to use default cache cluster.
- Rails.cache.read("a")
+```ruby
+Rails.cache.read("a")
+```
Supply an options with a :sheep key. It's value is cache cluster name.
- Rails.cache.read("a", :sheep => :cluster_a)
+```ruby
+Rails.cache.read("a", :sheep => :cluster_a)
+```
caches_action, fragment_cache are the same.
+
+```ruby
+<% cache "page", :sheep => :cluster_a do %>
+ <%= somethong %>
+<% end %>
+```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)