func (c CacheBranchMinus) Entries() int {
	return len(c.data)
}
Entries returns the number of entries in the cache.
package gosmt
import (
	"bytes"
	"crypto/rand"
	"math/big"
	"strconv"
)
type Cache interface {
	Exists(height uint64, base []byte) bool
	Get(height uint64, base []byte) []byte
	HashCache(left, right []byte, height uint64, base, split []byte,
		interiorHash func(left, right []byte, height uint64, base []byte) []byte,
		defaultHashes [][]byte) []byte
	Entries() int
}
type CacheNothing int
func (c CacheNothing) Exists(height uint64, base []byte) bool { return false }
func (c CacheNothing) Get(height uint64, base []byte) []byte { return nil }
func (c CacheNothing) HashCache(left, right []byte, height uint64, base, split []byte,
	interiorHash func(left, right []byte, height uint64, base []byte) []byte,
	defaultHashes [][]byte) []byte {
	return interiorHash(left, right, height, base)
}
func (c CacheNothing) Entries() int {
	return 0
}
type CacheBranch map[string][]byte
func (c CacheBranch) Exists(height uint64, base []byte) bool {
	_, exists := c[strconv.Itoa(int(height))+string(base)]
	return exists
}
func (c CacheBranch) Get(height uint64, base []byte) []byte {
	return c[strconv.Itoa(int(height))+string(base)]
}
func (c CacheBranch) HashCache(left, right []byte, height uint64, base, split []byte,
	interiorHash func(left, right []byte, height uint64, base []byte) []byte,
	defaultHashes [][]byte) []byte {
	h := interiorHash(left, right, height, base)
	if !bytes.Equal(defaultHashes[height-1], left) && !bytes.Equal(defaultHashes[height-1], right) {
		c[strconv.Itoa(int(height))+string(base)] = h
	} else {
		delete(c, strconv.Itoa(int(height))+string(base))
	}
	return h
}
func (c CacheBranch) Entries() int {
	return len(c)
}
type CacheBranchPlus map[string][]byte
func (c CacheBranchPlus) Exists(height uint64, base []byte) bool {
	_, exists := c[strconv.Itoa(int(height))+string(base)]
	return exists
}
func (c CacheBranchPlus) Get(height uint64, base []byte) []byte {
	return c[strconv.Itoa(int(height))+string(base)]
}
func (c CacheBranchPlus) HashCache(left, right []byte, height uint64, base, split []byte,
	interiorHash func(left, right []byte, height uint64, base []byte) []byte,
	defaultHashes [][]byte) []byte {
	h := interiorHash(left, right, height, base)
	if !bytes.Equal(defaultHashes[height-1], left) && !bytes.Equal(defaultHashes[height-1], right) {
		c[strconv.Itoa(int(height-1))+string(base)] = left
		c[strconv.Itoa(int(height-1))+string(split)] = right
	} else {
		delete(c, strconv.Itoa(int(height-1))+string(base))
		delete(c, strconv.Itoa(int(height-1))+string(split))
	}
	return h
}
func (c CacheBranchPlus) Entries() int {
	return len(c)
}
type CacheBranchMinus struct {
	data        map[string][]byte
	probability float64
}
func NewCacheBranchMinus(prob float64) *CacheBranchMinus {
	c := new(CacheBranchMinus)
	c.data = make(map[string][]byte)
	c.probability = prob
	return c
}
func (c CacheBranchMinus) Exists(height uint64, base []byte) bool {
	_, exists := c.data[strconv.Itoa(int(height))+string(base)]
	return exists
}
func (c CacheBranchMinus) Get(height uint64, base []byte) []byte {
	return c.data[strconv.Itoa(int(height))+string(base)]
}
func (c CacheBranchMinus) HashCache(left, right []byte, height uint64, base, split []byte,
	interiorHash func(left, right []byte, height uint64, base []byte) []byte,
	defaultHashes [][]byte) []byte {
	h := interiorHash(left, right, height, base)
	if randLess(c.probability) &&
		!bytes.Equal(defaultHashes[height-1], left) && !bytes.Equal(defaultHashes[height-1], right) {
		c.data[strconv.Itoa(int(height))+string(base)] = h
	} else {
		delete(c.data, strconv.Itoa(int(height))+string(base))
	}
	return h
}