cache

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a thread-safe store for chain configs. Data can only be changed via UpdateChains.

func New

func New(logger zerolog.Logger) *Cache

New creates a new Cache instance.

func (*Cache) GetAllChains

func (c *Cache) GetAllChains() []*ChainData

GetAllChains returns a slice copy of all chain data.

func (*Cache) GetChainData

func (c *Cache) GetChainData(chainID string) *ChainData

GetChainData returns a pointer copy of a chain's data, safe for reading. If not found, returns nil.

func (*Cache) LastUpdated

func (c *Cache) LastUpdated() time.Time

LastUpdated returns the last time the cache was refreshed.

func (*Cache) UpdateChains

func (c *Cache) UpdateChains(chains []*uregistrytypes.ChainConfig)

UpdateChains atomically replaces the entire cache.

type ChainData

type ChainData struct {
	Config    *uregistrytypes.ChainConfig
	UpdatedAt time.Time
}

ChainData holds a chain config and when it was last updated.

Jump to

Keyboard shortcuts

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