mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-27 12:05:40 +00:00
a20e46a80f
Updates #cleanup Change-Id: Ib3a33a7609530ef8c9f3f58fc607a61e8655c4b5 Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
24 lines
589 B
Go
24 lines
589 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package cache
|
|
|
|
// None provides no caching and always calls the provided FillFunc.
|
|
//
|
|
// It is safe for concurrent use if the underlying FillFunc is.
|
|
type None[K comparable, V any] struct{}
|
|
|
|
var _ Cache[int, int] = None[int, int]{}
|
|
|
|
// Get always calls the provided FillFunc and returns what it does.
|
|
func (c None[K, V]) Get(_ K, f FillFunc[V]) (V, error) {
|
|
v, _, e := f()
|
|
return v, e
|
|
}
|
|
|
|
// Forget implements Cache.
|
|
func (None[K, V]) Forget(K) {}
|
|
|
|
// Empty implements Cache.
|
|
func (None[K, V]) Empty() {}
|