マウリシオ・リニャレスされます正しい、しかし、私はいくつかのdetaiを追加したいなぜなら、どのメソッドを実装する必要があるのかは明らかではないと思うからです。
ActionDispatch::Session::AbstractStoreから継承できますが、実装する必要があるメソッドを探すのに適したRack::Session::Abstract::IDから継承しています。具体的には、Rack::Session::Abstract::IDから:
# All thread safety and session retrival proceedures should occur here.
# Should return [session_id, session].
# If nil is provided as the session id, generation of a new valid id
# should occur within.
def get_session(env, sid)
raise '#get_session not implemented.'
end
# All thread safety and session storage proceedures should occur here.
# Should return true or false dependant on whether or not the session
# was saved or not.
def set_session(env, sid, session, options)
raise '#set_session not implemented.'
end
# All thread safety and session destroy proceedures should occur here.
# Should return a new session id or nil if options[:drop]
def destroy_session(env, sid, options)
raise '#destroy_session not implemented'
end
私は実験のような単純なfile-based session storeを書きました。
'Rack :: Session :: Abstract :: ID'を継承しています。これは 'Rack :: Session :: Abstract :: Persisted'でなければなりません。 –
もう一つの実例は、['redis-session-store'](https://github.com/roidrage/redis-session-store)宝石です。 –