Sha256: 9c0c66d703261c579059776aca32c77b96273a24ab4b0652536734cba01edd29
Contents?: true
Size: 1.65 KB
Versions: 25
Compression:
Stored size: 1.65 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. # # :api: private 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
25 entries across 25 versions & 1 rubygems