drone-cache is a Go client library for creating cache plugins.
Download the package using go get
:
go get "github.com/drone-plugins/drone-cache"
Import the package:
import "github.com/drone-plugins/drone-cache/cache"
The drone-cache library provides an interface for a Storage
backend. When creating a new backend the following interface needs to be filled in.
type Storage interface {
Get(p string, dst io.Writer) error
Put(p string, src io.Reader) error
}
To create a Cache
object using a Storage
object:
cache, err := cache.New(storage)
To rebuild the cache:
err := cache.Rebuild(src, dst)
To restore the cache:
err := cache.Restore(src)
The drone-cache library currently supports the following file formats for cache storage
- .tar