Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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)
Click to show internal directories.
Click to hide internal directories.