From 395befc0628dc766d0ef5370e65b5b9b4d0a9678 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 19 Jan 2018 17:00:13 -0500 Subject: [PATCH] Update cache to satisfy Purge interface after context plumbing --- physical/cache.go | 4 +++- physical/inmem/cache_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/physical/cache.go b/physical/cache.go index 31cd61da0..bca629036 100644 --- a/physical/cache.go +++ b/physical/cache.go @@ -33,6 +33,8 @@ type TransactionalCache struct { Transactional } +var _ Purgable = &Cache{} + // NewCache returns a physical cache of the given size. // If no size is provided, the default size is used. func NewCache(b Backend, size int, coreExceptions []string, logger log.Logger) *Cache { @@ -72,7 +74,7 @@ func NewTransactionalCache(b Backend, size int, coreExceptions []string, logger } // Purge is used to clear the cache -func (c *Cache) Purge() { +func (c *Cache) Purge(ctx context.Context) { // Lock the world for _, lock := range c.locks { lock.Lock() diff --git a/physical/inmem/cache_test.go b/physical/inmem/cache_test.go index 31b8b02cd..8ace7db35 100644 --- a/physical/inmem/cache_test.go +++ b/physical/inmem/cache_test.go @@ -52,7 +52,7 @@ func TestCache_Purge(t *testing.T) { } // Clear the cache - cache.Purge() + cache.Purge(context.Background()) // Read should fail out, err = cache.Get(context.Background(), "foo")