2023-05-11 18:45:44 +00:00
|
|
|
package debian
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/rapidloop/skv"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Cache struct {
|
|
|
|
store *skv.KVStore
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCache(path string) (c *Cache, err error) {
|
|
|
|
c = &Cache{}
|
|
|
|
c.store, err = skv.Open(path)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-11 19:26:54 +00:00
|
|
|
func (c Cache) Put(p DebianKernel) error {
|
|
|
|
return c.store.Put(p.Version.Package, p)
|
2023-05-11 18:45:44 +00:00
|
|
|
}
|
|
|
|
|
2023-05-11 19:26:54 +00:00
|
|
|
func (c Cache) Get(version string) (p DebianKernel, err error) {
|
2023-05-11 18:45:44 +00:00
|
|
|
err = c.store.Get(version, &p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c Cache) Close() error {
|
|
|
|
return c.store.Close()
|
|
|
|
}
|