From: Matt Joiner Date: Thu, 26 Aug 2021 01:20:37 +0000 (+1000) Subject: Add function to wrap squirrel.Cache as storage.ClientImpl X-Git-Tag: v1.32.0~106 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=cf6c20d306bbe9a6231790eb102bfa45cdc24ff6;p=btrtrc.git Add function to wrap squirrel.Cache as storage.ClientImpl --- 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