cache

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: AGPL-3.0 Imports: 14 Imported by: 3

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.Exchange) (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