README.md in dalli-0.9.2 vs README.md in dalli-0.9.3
- old
+ new
@@ -25,10 +25,11 @@
0. uses the exact same algorithm to choose a server so existing memcached clusters with TBs of data will work identically to memcache-client.
1. is approximately 20% faster than memcache-client (which itself was heavily optimized) in Ruby 1.9.2.
2. contains explicit "chokepoint" methods which handle all requests; these can be hooked into by monitoring tools (NewRelic, Rack::Bug, etc) to track memcached usage.
3. comes with hooks to replace memcache-client in Rails.
4. is approx 700 lines of Ruby. memcache-client is approx 1250 lines.
+ 5. supports SASL for use in managed environments, e.g. Heroku.
Installation and Usage
------------------------
@@ -42,27 +43,59 @@
value = dc.get('abc')
The test suite requires memcached 1.4.3+ with SASL enabled (./configure --enable-sasl). Currently only supports the PLAIN mechanism.
-Usage with Rails
+Usage with Rails 3.0
---------------------------
In your Gemfile:
gem 'dalli'
-In `config/environments/production.rb`. Note that we are also setting a reasonable default for maximum cache entry lifetime (one day), enabling compression for large values, and namespacing all entries for this rails app. Remove the namespace if you have multiple apps which share cached values.
+In `config/environments/production.rb`:
- require 'active_support/cache/dalli_store'
+ config.cache_store = :dalli_store
+
+A more comprehensive example (note that we are setting a reasonable default for maximum cache entry lifetime (one day), enabling compression for large values, and namespacing all entries for this rails app. Remove the namespace if you have multiple apps which share cached values):
+
config.cache_store = :dalli_store, 'cache-1.example.com', 'cache-2.example.com',
:namespace => NAME_OF_RAILS_APP, :expires_in => 1.day, :compress => true, :compress_threshold => 64.kilobytes
+Usage with Rails 2.3.x
+----------------------------
+
+In `config/environment.rb`:
+
+ config.gem 'dalli'
+
+In `config/environments/production.rb`:
+
+ require 'active_support/cache/dalli_store23'
+ config.cache_store = :dalli_store
+
+
+Usage with Passenger
+------------------------
+
+Put this at the bottom of `config/environment.rb`:
+
+ if defined?(PhusionPassenger)
+ PhusionPassenger.on_event(:starting_worker_process) do |forked|
+ # Only works with DalliStore
+ Rails.cache.reset if forked
+ end
+ end
+
+
Features and Changes
------------------------
+Dalli is **NOT** 100% API compatible with memcache-client. If you have code which uses the MemCache
+API directly, it will likely need small tweaks. Method parameters and return values changed slightly.
+
memcache-client allowed developers to store either raw or marshalled values with each API call. I feel this is needless complexity; Dalli allows you to control marshalling per-Client with the `:marshal => false` flag but you cannot explicitly set the raw flag for each API call. By default, marshalling is enabled.
I've removed support for key namespaces and automatic pruning of keys longer than 250 characters. ActiveSupport::Cache implements these features so there is little need for Dalli to reinvent them.
By default, Dalli is thread-safe. Disable thread-safety at your own peril.
@@ -72,9 +105,15 @@
Helping Out
-------------
If you have a fix you wish to provide, please fork the code, fix in your local project and then send a pull request on github. Please ensure that you include a test which verifies your fix and update History.md with a one sentence description of your fix so you get credit as a contributor.
+
+
+Thanks
+------------
+
+Brian Mitchell - for his remix-stash project which was helpful when implementing and testing the binary protocol support.
Author
----------