mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
implement abstract store methods
converts old ID methods to the new abstract store methods in Rack
This commit is contained in:
parent
bcfa2a0d5e
commit
a8f4568f53
4 changed files with 8 additions and 8 deletions
|
@ -18,7 +18,7 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
# Get a session from the cache.
|
||||
def get_session(env, sid)
|
||||
def find_session(env, sid)
|
||||
unless sid and session = @cache.read(cache_key(sid))
|
||||
sid, session = generate_sid, {}
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
# Set a session in the cache.
|
||||
def set_session(env, sid, session, options)
|
||||
def write_session(env, sid, session, options)
|
||||
key = cache_key(sid)
|
||||
if session
|
||||
@cache.write(key, session, :expires_in => options[:expire_after])
|
||||
|
@ -37,7 +37,7 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
# Remove a session from the cache.
|
||||
def destroy_session(env, sid, options)
|
||||
def delete_session(env, sid, options)
|
||||
@cache.delete(cache_key(sid))
|
||||
generate_sid
|
||||
end
|
||||
|
|
|
@ -71,7 +71,7 @@ module ActionDispatch
|
|||
super(app, options.merge!(:cookie_only => true))
|
||||
end
|
||||
|
||||
def destroy_session(req, session_id, options)
|
||||
def delete_session(req, session_id, options)
|
||||
new_sid = generate_sid unless options[:drop]
|
||||
# Reset hash and Assign the new session id
|
||||
req.set_header("action_dispatch.request.unsigned_session_cookie", new_sid ? { "session_id" => new_sid } : {})
|
||||
|
@ -112,7 +112,7 @@ module ActionDispatch
|
|||
data
|
||||
end
|
||||
|
||||
def set_session(req, sid, session_data, options)
|
||||
def write_session(req, sid, session_data, options)
|
||||
session_data["session_id"] = sid
|
||||
session_data
|
||||
end
|
||||
|
|
|
@ -110,7 +110,7 @@ module ActionDispatch
|
|||
Class.new {
|
||||
def load_session(env); [1, {}]; end
|
||||
def session_exists?(env); true; end
|
||||
def destroy_session(env, id, options); 123; end
|
||||
def delete_session(env, id, options); 123; end
|
||||
}.new
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,13 +10,13 @@ module ActionDispatch
|
|||
super
|
||||
end
|
||||
|
||||
def get_session(env, sid)
|
||||
def find_session(env, sid)
|
||||
sid ||= 1
|
||||
session = @sessions[sid] ||= {}
|
||||
[sid, session]
|
||||
end
|
||||
|
||||
def set_session(env, sid, session, options)
|
||||
def write_session(env, sid, session, options)
|
||||
@sessions[sid] = session
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue