Maurício लिन्हारेस है सही, हालांकि, मैं कुछ 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 लिखा था।
स्रोत
2012-08-13 15:37:15
'रैक :: सत्र :: सार :: आईडी' को हटा दिया गया है। अब यह 'रैक :: सत्र :: सार :: स्थिर' होना चाहिए। –
एक और वास्तविक जीवन उदाहरण ['redis-session-store'] है (https://github.com/roidrage/redis-session-store) मणि। –