Add function to wrap squirrel.Cache as storage.ClientImpl

This commit is contained in:
Matt Joiner 2021-08-26 11:20:37 +10:00
parent 91873addfa
commit cf6c20d306
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,13 @@ func NewDirectStorage(opts NewDirectStorageOpts) (_ storage.ClientImplCloser, er
}, nil
}
func NewWrappingClient(cache *squirrel.Cache) storage.ClientImpl {
return &client{
cache,
cache.GetCapacity,
}
}
type client struct {
*squirrel.Cache
capacity func() *int64