mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
30 lines
592 B
Go
30 lines
592 B
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package cache
|
|
|
|
import "github.com/luxfi/utils"
|
|
|
|
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) {
|
|
return utils.Zero[V](), false
|
|
}
|
|
|
|
func (*Empty[K, _]) Evict(K) {}
|
|
|
|
func (*Empty[_, _]) Flush() {}
|
|
|
|
func (*Empty[_, _]) Len() int {
|
|
return 0
|
|
}
|
|
|
|
func (*Empty[_, _]) PortionFilled() float64 {
|
|
return 0
|
|
}
|