Class: Factorix::CLI::Commands::Cache::Stat
- Includes:
- Formatting
- Defined in:
- lib/factorix/cli/commands/cache/stat.rb
Overview
Display cache statistics
This command outputs statistics for all cache stores in a human-readable or JSON format.
Instance Method Summary collapse
-
#call(json:) ⇒ void
Execute the cache stat command.
Methods included from Formatting
#format_duration, #format_size
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Method Details
#call(json:) ⇒ void
This method returns an undefined value.
Execute the cache stat command
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/factorix/cli/commands/cache/stat.rb', line 41 def call(json:, **) logger.debug("Collecting cache statistics") cache_names = Factorix.config.cache.values.keys stats = cache_names.to_h {|name| [name, collect_stats(name)] } if json out.puts JSON.pretty_generate(stats) else output_text(stats) end end |