vagrant-cachier-ng/docs/buckets/generic.md
Gustavo L. de M. Chaves 8ac8d7f6f6 Fix multi generic bucket set up
The previously documented way to specify multiple generic buckets
doesn't work because vagrant-cachier can't enable a bucket type more
than once.

Here we generalize the configs hash that the generic bucket gets making
it possible to specify multiple buckets with a single hash. The
documentation is changed accordingly.

Note that we keep it backwards compatible for single generic bucket
specification.

Issue: https://github.com/fgrehm/vagrant-cachier/issues/99
2014-04-16 09:04:49 -03:00

1.1 KiB

Generic

This bucket is never enabled by default. You have to enable it explicitly like this:

Vagrant.configure("2") do |config|
  config.cache.enable :generic, { :cache_dir => "/var/cache/some" }
end

The :cache_dir parameter is required. It specifies the directory on the guest that will be cached under the "/tmp/vagrant-cache/generic" bucket.

You may enable more than one generic bucket by giving them different names, like this:

Vagrant.configure("2") do |config|
  config.cache.enable :generic, {
    "one" => { cache_dir: "/var/cache/one" },
    "two" => { cache_dir: "/var/cache/two" },
  }
end

In this case you get two buckets called "one" and "two" under the guest's /tmp/vagrant-cache directory.

The Generic bucket is useful if you want to implement a caching mechanism by hand. For instance, if you want to cache your wget downloads under /var/cache/wget you can do this:

Vagrant.configure("2") do |config|
  config.cache.enable :generic, {
    "wget" => { cache_dir: "/var/cache/wget" },
  }
end

Then, you invoke wget like this:

wget -N -P /var/cache/wget URL