Class: Zetto::Storage::Session::FindBySession
- Inherits:
-
Object
- Object
- Zetto::Storage::Session::FindBySession
- Defined in:
- lib/zetto/storage/session/find_by_session.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(session_id) ⇒ FindBySession
constructor
A new instance of FindBySession.
Constructor Details
#initialize(session_id) ⇒ FindBySession
Returns a new instance of FindBySession.
6 7 8 9 |
# File 'lib/zetto/storage/session/find_by_session.rb', line 6 def initialize(session_id) @redis = Zetto::Storage::Connect::RedisSingelton.get @session_id = session_id end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/zetto/storage/session/find_by_session.rb', line 11 def execute begin key = "session:" + @session_id.to_s data = {} data = @redis.hgetall(key) data['time_live_s'] = @redis.ttl(key) data["session_id"] = @session_id.to_s return Zetto::Storage::Session::Data::Response.new(data) rescue Exception => e Zetto::Services::Info. I18n.t('exseptions.unknown_error', argument: 'Zetto::Storage::Session::FindBySession', current_method: __method__), e nil end end |