cache

package
v0.0.0-...-c0411a1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

func HomeDir

func HomeDir() string

func LoadExchangeMarketsWithCache

func LoadExchangeMarketsWithCache(ctx context.Context, ex types.ExchangePublic) (markets types.MarketMap, err error)

func WithCache

func WithCache(key string, obj interface{}, fetcher DataFetcher) error

WithCache let you use the cache with the given cache key, variable reference and your data fetcher, The key must be an unique ID. obj is the pointer of your local variable fetcher is the closure that will fetch your remote data or some slow operation.

Types

type DataFetcher

type DataFetcher func() (interface{}, error)

Jump to

Keyboard shortcuts

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