Sha256: 3a650e5862e7dfdf22265daad11a4edf6f0fd33356a3aedf3a12be40911ace30
Contents?: true
Size: 834 Bytes
Versions: 3
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true module Loco class WsConnectionStorage include Singleton attr_reader :storage class << self def current instance end end def initialize @storage = Config.redis_instance || {} end def get(key) case @storage when Hash storage[proper_key(key)] else storage.get proper_key(key) end end def set(key, val) case @storage when Hash storage[proper_key(key)] = val else storage.set proper_key(key), val end end def del(key) case @storage when Hash storage.delete proper_key(key) else storage.del proper_key(key) end end protected def proper_key(key) "#{Config.app_name}:#{key}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loco-rails-4.1.1 | lib/loco/ws_connection_storage.rb |
loco-rails-4.1.0 | lib/loco/ws_connection_storage.rb |
loco-rails-4.0.0 | lib/loco/ws_connection_storage.rb |