README.md in dalli-1.1.5 vs README.md in dalli-2.0.0

- old
+ new

@@ -1,9 +1,9 @@ Dalli ========= -Dalli is a high performance pure Ruby client for accessing memcached servers. It works with memcached 1.4+ only as it uses the newer binary protocol. It should be considered a replacement for the memcache-client gem. The API tries to be mostly compatible with memcache-client with the goal being to make it a drop-in replacement for Rails. +Dalli is a high performance pure Ruby client for accessing memcached servers. It works with memcached 1.4+ only as it uses the newer binary protocol. It should be considered a replacement for the memcache-client gem. The name is a variant of Salvador Dali for his famous painting [The Persistence of Memory](http://en.wikipedia.org/wiki/The_Persistence_of_Memory). ![Persistence of Memory](http://www.virtualdali.com/assets/paintings/31PersistenceOfMemory.jpg) @@ -23,14 +23,12 @@ So a few notes. Dalli: 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. supports SASL for use in managed environments, e.g. Heroku. - 5. provides proper failover with recovery and adjustable timeouts - 6. has a backwards-compatibility mode for people migrating from memcache-client (see Upgrade.md). + 3. supports SASL for use in managed environments, e.g. Heroku. + 4. provides proper failover with recovery and adjustable timeouts Supported Ruby versions and implementations ------------------------------------------------ @@ -45,12 +43,11 @@ Installation and Usage ------------------------ -Remember, Dalli **requires** memcached 1.4+. You can check the version with `memcached -h`. Please note that memcached that Mac OS X Snow Leopard ships with is 1.2.8 and -won't work. Install 1.4.x using Homebrew with +Remember, Dalli **requires** memcached 1.4+. You can check the version with `memcached -h`. Please note that memcached that Mac OS X Snow Leopard ships with is 1.2.8 and won't work. Install 1.4.x using Homebrew with brew install memcached You can verify your installation using this piece of code: @@ -63,11 +60,11 @@ value = dc.get('abc') The test suite requires memcached 1.4.3+ with SASL enabled (brew install memcached --enable-sasl ; mv /usr/bin/memcached /usr/bin/memcached.old). Currently only supports the PLAIN mechanism. Dalli has no runtime dependencies and never will. You can optionally install the 'kgio' gem to -give Dalli a 10-20% performance boost. +give Dalli a 20-30% performance boost. Usage with Rails 3.x --------------------------- @@ -77,27 +74,23 @@ In `config/environments/production.rb`: 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): +Here's a more comprehensive example that sets a reasonable default for maximum cache entry lifetime (one day), enables compression for large values and namespaces 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, :compression => true } + { :namespace => NAME_OF_RAILS_APP, :expires_in => 1.day, :compress => true } To use Dalli for Rails session storage, in `config/initializers/session_store.rb`: require 'action_dispatch/middleware/session/dalli_store' Rails.application.config.session_store :dalli_store, :memcache_server => ['host1', 'host2'], :namespace => 'sessions', :key => '_foundation_session', :expire_after => 30.minutes +Dalli does not support Rails 2.x any longer. -Usage with Rails 2.3.x ----------------------------- -Dalli v1.1+ does not support Rails 2.3. Please use an earlier version: gem install dalli -v "~> 1.0.4" - - Usage with Passenger ------------------------ Put this at the bottom of `config/environment.rb`: @@ -120,11 +113,11 @@ **expires_in**: Global default for key TTL. No default. **failover**: Boolean, if true Dalli will failover to another server if the main server for a key is down. -**compression**: Boolean, if true Dalli will gzip-compress values larger than 1K. +**compress**: Boolean, if true Dalli will gzip-compress values larger than 1K. **socket_timeout**: Timeout for all socket operations (connect, read, write). Default is 0.5. **socket_max_failures**: When a socket operation fails after socket_timeout, the same operation is retried. This is to not immediately mark a server down when there's a very slight network problem. Default is 2. @@ -136,21 +129,17 @@ **username**: The username to use for authenticating this client instance against a SASL-enabled memcached server. Heroku users should not need to use this normally. **password**: The password to use for authenticating this client instance against a SASL-enabled memcached server. Heroku users should not need to use this normally. -**async**: Boolean, if true Dalli will assume its running inside the EventMachine reactor and use EM through the em-synchrony gem. Currently disables the socket_timeout option. Default is false. +**keepalive**: Boolean, if true Dalli will enable keep-alives on the socket so inactivity 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. See Upgrade.md for more detail. - By default, Dalli is thread-safe. Disable thread-safety at your own peril. -Multi-threaded use will fail if used with EventMachine. - Note that Dalli does not require ActiveSupport or Rails. You can safely use it in your own Ruby projects. Helping Out ------------- @@ -169,10 +158,12 @@ Author ---------- -Mike Perham, mperham@gmail.com, [mikeperham.com](http://mikeperham.com), [@mperham](http://twitter.com/mperham) If you like and use this project, please give me a recommendation at [WWR](http://workingwithrails.com/person/10797-mike-perham). Happy caching! +Mike Perham, mperham@gmail.com, [mikeperham.com](http://mikeperham.com), [@mperham](http://twitter.com/mperham) If you like and use this project, please give me a recommendation at [WWR](http://workingwithrails.com/person/10797-mike-perham) or send a few bucks my way via my Pledgie page below. Happy caching! + +<a href='http://www.pledgie.com/campaigns/16623'><img alt='Click here to lend your support to Open Source and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16623.png?skin_name=chrome' border='0' /></a> Copyright -----------