Module: Bsdkrun::Caches

Defined in:
lib/bsdkrun/cache.rb

Overview

Host-level cache operations, mirroring volumes.

Class Method Summary collapse

Class Method Details

.lsArray<CacheEntry>

Returns every stored entry, newest first.

Returns:

  • (Array<CacheEntry>)

    every stored entry, newest first.



94
95
96
97
# File 'lib/bsdkrun/cache.rb', line 94

def ls
  out = Process.run!(["cache", "ls", "--json"], label: "bsdkrun cache ls").stdout
  JSON.parse(out.strip.empty? ? "[]" : out).map { |row| CacheEntry.from(row) }
end

.rm(keys = [], all: false) ⇒ void

This method returns an undefined value.

Remove entries by key, or every one with all: true.



101
102
103
104
105
106
107
108
109
110
# File 'lib/bsdkrun/cache.rb', line 101

def rm(keys = [], all: false)
  args = ["cache", "rm"]
  if all
    args << "--all"
  else
    args += Array(keys)
  end
  Process.run!(args, label: "bsdkrun cache rm")
  nil
end