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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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