Class: ActionDispatch::Session::IronCache
- Inherits:
-
AbstractStore
- Object
- AbstractStore
- ActionDispatch::Session::IronCache
- Defined in:
- lib/action_dispatch/session/iron_cache.rb
Instance Method Summary collapse
- #destroy_session(env, session_id, options = {}) ⇒ Object
- #get_session(env, session_id) ⇒ Object
-
#initialize(app, options = {}) ⇒ IronCache
constructor
A new instance of IronCache.
- #options ⇒ Object
- #set_session(env, session_id, session, options = {}) ⇒ Object
Constructor Details
#initialize(app, options = {}) ⇒ IronCache
9 10 11 12 13 14 |
# File 'lib/action_dispatch/session/iron_cache.rb', line 9 def initialize(app, = {}) @options = super @client = ::IronCache::Client.new() end |
Instance Method Details
#destroy_session(env, session_id, options = {}) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/action_dispatch/session/iron_cache.rb', line 42 def destroy_session(env, session_id, ={}) with_namespace(session_id, ) do |cache, k| cache.delete(k) rescue nil end generate_sid end |
#get_session(env, session_id) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/action_dispatch/session/iron_cache.rb', line 20 def get_session(env, session_id) item = nil session_id ||= generate_sid with_namespace(session_id, ) do |cache, k| item = cache.get(k) item = item.value unless item.nil? end session_data = deserialize_entry(item) rescue {} [session_id, session_data] end |
#options ⇒ Object
16 17 18 |
# File 'lib/action_dispatch/session/iron_cache.rb', line 16 def @options end |
#set_session(env, session_id, session, options = {}) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/action_dispatch/session/iron_cache.rb', line 34 def set_session(env, session_id, session, ={}) with_namespace(session_id, ) do |cache, k| cache.put(k, serialize_entry(session, ), ) end session_id end |