Sha256: fd65d1d9d8d4405650b8db9a967fee710e45a0c4111fe3b6f0be29b5ff631a1a
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
require 'cgi' require 'cgi/session' class CGI #:nodoc:all class Session class CachetasticStore def check_id(id) #:nodoc:# /[^0-9a-zA-Z]+/ =~ id.to_s ? false : true end def initialize(session, options = {}) id = session.session_id unless check_id(id) raise ArgumentError, "session_id '%s' is invalid" % id end @session_key = id @session_data = {} end # Restore session state from the session's memcache entry. # # Returns the session state as a hash. def restore @session_data = Cachetastic::Caches::RailsSessionCache.get(@session_key) do {} end end # Save session state to the session's memcache entry. def update Cachetastic::Caches::RailsSessionCache.set(@session_key, @session_data) end # Update and close the session's memcache entry. def close update end # Delete the session's memcache entry. def delete Cachetastic::Caches::RailsSessionCache.delete(@session_key) @session_data = {} end def data @session_data end end end end
Version data entries
5 entries across 5 versions & 1 rubygems