github.com/ava-labs/avalanchego@v1.11.11/cache/empty_cache.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package cache
     5  
     6  import "github.com/ava-labs/avalanchego/utils"
     7  
     8  var _ Cacher[struct{}, struct{}] = (*Empty[struct{}, struct{}])(nil)
     9  
    10  type Empty[K any, V any] struct{}
    11  
    12  func (*Empty[K, V]) Put(K, V) {}
    13  
    14  func (*Empty[K, V]) Get(K) (V, bool) {
    15  	return utils.Zero[V](), false
    16  }
    17  
    18  func (*Empty[K, _]) Evict(K) {}
    19  
    20  func (*Empty[_, _]) Flush() {}
    21  
    22  func (*Empty[_, _]) Len() int {
    23  	return 0
    24  }
    25  
    26  func (*Empty[_, _]) PortionFilled() float64 {
    27  	return 0
    28  }