vagrant-cachier-ng/docs/buckets/generic.md
Gustavo L. de M. Chaves a63156e482 Implement generic bucket
This bucket must be explicitly enabled and may be useful for users
wanting a generic caching mechanism that they can use directly instead
of via some predefined packaging system.

For instance, this enables one to implement a cache for packages
downloaded via wget or curl.
2014-03-23 22:29:23 -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 "generic" bucket.

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

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

In this case you get two buckets called "generic-one" and "generic-two".

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, { :name => wget, :cache_dir => "/var/cache/wget" }
end

Then, you invoke wget like this:

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