cache

package
v0.1.1-experimental.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// HeaderSize is the size of the header cache.
	HeaderSize int `mapstructure:"header-size"`
	// HeaderTTL is the time-to-live for headers in the cache.
	HeaderTTL time.Duration `mapstructure:"header-ttl"`
}

Config is the configuration for an EngineCache.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for an EngineCache.

type EngineCache

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

EngineCache is a cache for data retrieved by the EngineClient.

func NewEngineCache

func NewEngineCache(
	config Config,
) *EngineCache

NewEngineCacheWithConfig creates a new EngineCache with the given config.

func NewEngineCacheWithDefaultConfig

func NewEngineCacheWithDefaultConfig() *EngineCache

NewEngineCache creates a new EngineCache.

func (*EngineCache) AddHeader

func (c *EngineCache) AddHeader(
	header *primitives.ExecutionHeader,
)

AddHeader adds the given header to the cache.

func (*EngineCache) HeaderByHash

func (c *EngineCache) HeaderByHash(
	hash primitives.ExecutionHash,
) (*primitives.ExecutionHeader, bool)

HeaderByHash returns the header with the given hash.

func (*EngineCache) HeaderByNumber

func (c *EngineCache) HeaderByNumber(
	number uint64,
) (*primitives.ExecutionHeader, bool)

HeaderByNumber returns the header with the given number.

Jump to

Keyboard shortcuts

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