Sha256: c628a5bfc86ecb43187610456723ac40f94b4d81abc64fbdb91b3466dee61f22
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module RedisWebManager class Data < Base BASE = 'RedisWebManager' def perform now = Time.now.to_i seconds = (now + lifespan.to_i) - now redis.setex("#{BASE}_#{now}", seconds, serialize.to_json) end private def serialize { date: Time.now, memory: memory, client: client, cpu: cpu } end def memory { used_memory: stats[:used_memory], used_memory_rss: stats[:used_memory_rss], used_memory_peak: stats[:used_memory_peak], used_memory_overhead: stats[:used_memory_overhead], used_memory_startup: stats[:used_memory_startup], used_memory_dataset: stats[:used_memory_dataset] } end def client { connected_clients: stats[:connected_clients], blocked_clients: stats[:blocked_clients] } end def cpu { used_cpu_sys: stats[:used_cpu_sys], used_cpu_user: stats[:used_cpu_user], used_cpu_sys_children: stats[:used_cpu_sys_children], used_cpu_user_children: stats[:used_cpu_user_children] } end def stats @stats ||= redis.info.symbolize_keys end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis_web_manager-0.1.6 | lib/redis_web_manager/data.rb |