lrucachehashandwindowsizetoblockghostdagdatahashpairs

package
v0.12.18-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: ISC Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRUCache

type LRUCache struct {
	// contains filtered or unexported fields
}

LRUCache is a least-recently-used cache from lruKey to *externalapi.BlockGHOSTDAGDataHashPair

func New

func New(capacity int, preallocate bool) *LRUCache

New creates a new LRUCache

func (*LRUCache) Add

func (c *LRUCache) Add(blockHash *externalapi.DomainHash, windowSize int, value []*externalapi.BlockGHOSTDAGDataHashPair)

Add adds an entry to the LRUCache

func (*LRUCache) Get

func (c *LRUCache) Get(blockHash *externalapi.DomainHash, windowSize int) ([]*externalapi.BlockGHOSTDAGDataHashPair, bool)

Get returns the entry for the given key, or (nil, false) otherwise

func (*LRUCache) Has

func (c *LRUCache) Has(blockHash *externalapi.DomainHash, windowSize int) bool

Has returns whether the LRUCache contains the given key

func (*LRUCache) Remove

func (c *LRUCache) Remove(blockHash *externalapi.DomainHash, windowSize int)

Remove removes the entry for the the given key. Does nothing if the entry does not exist

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL