From cf6c20d306bbe9a6231790eb102bfa45cdc24ff6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 26 Aug 2021 11:20:37 +1000 Subject: [PATCH] Add function to wrap squirrel.Cache as storage.ClientImpl --- storage/sqlite/direct.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storage/sqlite/direct.go b/storage/sqlite/direct.go index fe5b2701..b36867fa 100644 --- a/storage/sqlite/direct.go +++ b/storage/sqlite/direct.go @@ -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 -- 2.48.1