Sha256: a41a543470079cbac19949b83d507879151b058fbb3fe8ef4be805025cca3b6b
Contents?: true
Size: 1.62 KB
Versions: 11
Compression:
Stored size: 1.62 KB
Contents
module Merb # Sessions stored in memcached. # # Requires setup in your +init.rb+. # # This for the 'memcache-client' gem: # # Merb::BootLoader.after_app_loads do # require 'memcache' # Merb::MemcacheSession.store = # MemCache.new('127.0.0.1:11211', :namespace => 'my_app') # end # # Or this for the 'memcached' gem: # # Merb::BootLoader.after_app_loads do # require 'memcache' # Merb::MemcacheSession.store = # Memcached.new('127.0.0.1:11211', :namespace => 'my_app') # end class MemcacheSession < SessionStoreContainer # The session store type self.session_store_type = :memcache end module MemcacheStore # Make the Memcached gem conform to the SessionStoreContainer interface # ==== Parameters # session_id<String>:: ID of the session to retrieve. # # ==== Returns # ContainerSession:: The session corresponding to the ID. # # @api private def retrieve_session(session_id) get("session:#{session_id}") end # ==== Parameters # session_id<String>:: ID of the session to set. # data<ContainerSession>:: The session to set. # # @api private def store_session(session_id, data) set("session:#{session_id}", data) end # ==== Parameters # session_id<String>:: ID of the session to delete. def delete_session(session_id) delete("session:#{session_id}") end end end # For the memcached gem. class Memcached include Merb::MemcacheStore end # For the memcache-client gem. class MemCache include Merb::MemcacheStore end
Version data entries
11 entries across 11 versions & 1 rubygems