From 0a33bde865aec94f162c7a5351f3b8fd7c6abc37 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 4 May 2025 01:00:08 +0300 Subject: [PATCH] federation/cache: expose noop cache as variable instead of type --- federation/cache.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/federation/cache.go b/federation/cache.go index 301091b3..24154974 100644 --- a/federation/cache.go +++ b/federation/cache.go @@ -136,16 +136,18 @@ func (c *InMemoryCache) ShouldReQuery(serverName string) bool { return true } -type NoopCache struct{} +type noopCache struct{} -func (*NoopCache) StoreKeys(_ *ServerKeyResponse) {} -func (*NoopCache) LoadKeys(_ string) (*ServerKeyResponse, error) { return nil, nil } -func (*NoopCache) StoreFetchError(_ string, _ error) {} -func (*NoopCache) ShouldReQuery(_ string) bool { return true } -func (*NoopCache) StoreResolution(_ *ResolvedServerName) {} -func (*NoopCache) LoadResolution(_ string) (*ResolvedServerName, error) { return nil, nil } +func (*noopCache) StoreKeys(_ *ServerKeyResponse) {} +func (*noopCache) LoadKeys(_ string) (*ServerKeyResponse, error) { return nil, nil } +func (*noopCache) StoreFetchError(_ string, _ error) {} +func (*noopCache) ShouldReQuery(_ string) bool { return true } +func (*noopCache) StoreResolution(_ *ResolvedServerName) {} +func (*noopCache) LoadResolution(_ string) (*ResolvedServerName, error) { return nil, nil } var ( - _ ResolutionCache = (*NoopCache)(nil) - _ KeyCache = (*NoopCache)(nil) + _ ResolutionCache = (*noopCache)(nil) + _ KeyCache = (*noopCache)(nil) ) + +var NoopCache *noopCache