Sha256: 5052bcd80a269bb3e8f975dbcd358ff23575fdffe412da8b85890de28111a342

Contents?: true

Size: 546 Bytes

Versions: 7

Compression:

Stored size: 546 Bytes

Contents

module HaveAPI::Fs::Components
  class CacheStats < File
    def read
      c = context.cache

      {
          size: c.size,
          hits: c.hits,
          misses: c.misses,
          invalid: c.invalid,
          drops: c.drops,
          hitratio: (c.hits.to_f / (c.hits + c.misses + c.invalid) * 100).round(2),
          sweeps: c.runs,
          last_sweep: (c.last_time && c.last_time.iso8601) || '-',
          next_sweep: c.next_time.iso8601,
      }.map { |k, v| sprintf('%-15s %s', "#{k}:", v) }.join("\n") + "\n"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
haveapi-fs-0.11.0 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.10.0 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.9.0 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.8.0 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.7.1 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.7.0 lib/haveapi/fs/components/cache_stats.rb
haveapi-fs-0.1.0 lib/haveapi/fs/components/cache_stats.rb