<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,3 @@
-require 'memcache_util'
 module Merb
 
   module SessionMixin #:nodoc:
@@ -19,7 +18,11 @@ module Merb
     # session has changed.
     def finalize_session 
       if @_fingerprint != Marshal.dump(request.session.data).hash
-        ::Cache.put(&quot;session:#{request.session.session_id}&quot;, request.session.data)
+        begin
+          CACHE.set(&quot;session:#{request.session.session_id}&quot;, request.session.data)
+        rescue =&gt; err
+          Merb.logger.debug(&quot;MemCache Error: #{err.message}&quot;)
+        end
       end
       set_cookie(_session_id_key, request.session.session_id, Time.now + _session_expiry) if (@_new_cookie || request.session.needs_new_cookie)
     end
@@ -34,7 +37,7 @@ module Merb
   ##
   # Sessions stored in memcached.
   #
-  # Requires setup in your +init.rb+:
+  # Requires setup in your +init.rb+.
   #
   #   require 'memcache'
   #   CACHE = MemCache.new('127.0.0.1:11211', { :namespace =&gt; 'my_app' })
@@ -42,6 +45,12 @@ module Merb
   # And a setting in +init.rb+:
   #
   #   c[:session_store] = 'memcache'
+  #
+  # If you are using the memcached gem instead of memcache-client, you must setup like this:
+  #
+  #   require 'memcached'
+  #   CACHE = Memcached.new('127.0.0.1:11211', { :namespace =&gt; 'my_app' })
+  #
   class MemCacheSession
 
     attr_accessor :session_id
@@ -75,7 +84,11 @@ module Merb
       #   sessions matched session_id, a new MemCacheSession will be generated.
       def persist(session_id)
         unless session_id.blank?
-          session = ::Cache.get(&quot;session:#{session_id}&quot;)
+          begin
+            session = CACHE.get(&quot;session:#{session_id}&quot;)
+          rescue =&gt; err
+            Merb.logger.debug(&quot;MemCache Error: #{err.message}&quot;)
+          end
           if session.nil?
             # Not in memcached, but assume that cookie exists
             session = new(session_id)
@@ -92,7 +105,6 @@ module Merb
           session_object.data = session
           [session_object, session_object.session_id]
         end
-
       end
 
       # Don't try to reload in dev mode.</diff>
      <filename>lib/merb-core/dispatch/session/memcached.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b2ffd00832890a37793691854149893eccf0cc31</id>
    </parent>
  </parents>
  <author>
    <name>Sindre Aarsaether</name>
    <email>sindre@identu.no</email>
  </author>
  <url>http://github.com/somebee/merb-core/commit/cfda52e392341f17834c5e2bd3779bc506da5d25</url>
  <id>cfda52e392341f17834c5e2bd3779bc506da5d25</id>
  <committed-date>2008-04-26T08:03:15-07:00</committed-date>
  <authored-date>2008-04-26T08:03:15-07:00</authored-date>
  <message>Removed dependency on memcache-client 'memcache_util.rb' which was dependent on ActiveRecord::Base for logging exceptions.
Now memcache works with both memcache-client gem and memcached gem. It also works withouth ActiveRecord.</message>
  <tree>ce2822c3e9abedfecb448fa8428b5cc7ed780a5a</tree>
  <committer>
    <name>Sindre Aarsaether</name>
    <email>sindre@identu.no</email>
  </committer>
</commit>
