Class: NetSystem::RedisClient
- Inherits:
-
Client
- Object
- Liza::Unit
- Liza::Controller
- Client
- NetSystem::RedisClient
- Defined in:
- lib/net_system/sub/database/clients/redis_client.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
Methods inherited from Liza::Controller
color, inherited, on_connected
Methods inherited from Liza::Unit
const_missing, division, part, system, #system, test_class
Constructor Details
#initialize(*args) ⇒ RedisClient
5 6 7 8 9 10 11 12 |
# File 'lib/net_system/sub/database/clients/redis_client.rb', line 5 def initialize *args require "redis" t = Time.now args = [url: NetBox[:client].get(:redis_url)] if args.empty? @conn = Redis.new(*args) ensure log "#{t.diff}s | Connecting to #{args}" end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
14 15 16 |
# File 'lib/net_system/sub/database/clients/redis_client.rb', line 14 def conn @conn end |
Instance Method Details
#call(cmd_name, *args) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/net_system/sub/database/clients/redis_client.rb', line 16 def call cmd_name, *args t = Time.now result = @conn.send cmd_name, *args result ensure log "#{t.diff}s | #{cmd_name} | #{args}" end |
#now ⇒ Object
25 26 27 |
# File 'lib/net_system/sub/database/clients/redis_client.rb', line 25 def now call :time end |