mirror of
https://github.com/luxfi/cache.git
synced 2026-09-24 00:24:18 +00:00
29 lines
561 B
Go
29 lines
561 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package cache
|
|
|
|
var _ Cacher[struct{}, struct{}] = (*Empty[struct{}, struct{}])(nil)
|
|
|
|
// Empty is a cache that doesn't store anything.
|
|
type Empty[K any, V any] struct{}
|
|
|
|
func (*Empty[K, V]) Put(K, V) {}
|
|
|
|
func (*Empty[K, V]) Get(K) (V, bool) {
|
|
var zero V
|
|
return zero, false
|
|
}
|
|
|
|
func (*Empty[K, _]) Evict(K) {}
|
|
|
|
func (*Empty[_, _]) Flush() {}
|
|
|
|
func (*Empty[_, _]) Len() int {
|
|
return 0
|
|
}
|
|
|
|
func (*Empty[_, _]) PortionFilled() float64 {
|
|
return 0
|
|
}
|