Class: Vines::Stream::Http::Sessions
- Inherits:
-
Object
- Object
- Vines::Stream::Http::Sessions
- Includes:
- Log
- Defined in:
- lib/vines/stream/http/sessions.rb
Overview
Sessions is a cache of Http::Session objects for transient HTTP connections. The cache is monitored for expired client connections.
Constant Summary collapse
- @@instance =
nil
Class Method Summary collapse
Instance Method Summary collapse
- #[](sid) ⇒ Object
- #[]=(sid, session) ⇒ Object
- #delete(sid) ⇒ Object
-
#initialize ⇒ Sessions
constructor
A new instance of Sessions.
Methods included from Log
Constructor Details
#initialize ⇒ Sessions
Returns a new instance of Sessions.
28 29 30 31 |
# File 'lib/vines/stream/http/sessions.rb', line 28 def initialize @sessions = {} start_timer end |
Class Method Details
.[](sid) ⇒ Object
16 17 18 |
# File 'lib/vines/stream/http/sessions.rb', line 16 def self.[](sid) instance[sid] end |
.[]=(sid, session) ⇒ Object
20 21 22 |
# File 'lib/vines/stream/http/sessions.rb', line 20 def self.[]=(sid, session) instance[sid] = session end |
.delete(sid) ⇒ Object
24 25 26 |
# File 'lib/vines/stream/http/sessions.rb', line 24 def self.delete(sid) instance.delete(sid) end |
.instance ⇒ Object
12 13 14 |
# File 'lib/vines/stream/http/sessions.rb', line 12 def self.instance @@instance ||= self.new end |
Instance Method Details
#[](sid) ⇒ Object
37 38 39 |
# File 'lib/vines/stream/http/sessions.rb', line 37 def [](sid) @sessions[sid] end |
#[]=(sid, session) ⇒ Object
33 34 35 |
# File 'lib/vines/stream/http/sessions.rb', line 33 def []=(sid, session) @sessions[sid] = session end |
#delete(sid) ⇒ Object
41 42 43 |
# File 'lib/vines/stream/http/sessions.rb', line 41 def delete(sid) @sessions.delete(sid) end |