cache

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveAssetCid

func ResolveAssetCid(serviceable iface.Serviceable) (string, error)

TODO: This should return a cid.Cid

Types

type Cache

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

The Cache struct wraps cache methods for use by node-services.

func New

func New() *Cache

New creates new cache object to be used by Node sub-services for caching serviceables.

The serviceables are stored in a map of serviceables map, where the map key is the matcher cache prefix value. The serviceable itself is stored by the id of the serviceable.

func (*Cache) Add

func (c *Cache) Add(serviceable iface.Serviceable) (iface.Serviceable, error)

Add method adds the serviceable to the given Cache object.

func (*Cache) Close

func (c *Cache) Close()

Close safely clears the cache and releases resources.

This method locks the cache, sets the cacheMap to nil, and then unlocks the cache to ensure that other goroutines can safely access the cache once it has been cleared.

func (*Cache) Get

func (c *Cache) Get(matcher iface.MatchDefinition, ops iface.GetOptions) ([]iface.Serviceable, error)

Get method gets the list of serviceables from the cache map, where the serviceables that are returned are those with a high match for given match definition.

func (*Cache) Remove

func (c *Cache) Remove(serviceable iface.Serviceable)

Remove removes a single serviceable from the cache.

Jump to

Keyboard shortcuts

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