scache

package
v0.0.0-...-54a3692 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 3 Imported by: 0

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 stores the internal state.

func New

func New(defaultExpiration, cleanupInterval time.Duration) *Cache

New creates an instance based on expiration and cleanup interval.

func (*Cache) ResponseChan

func (c *Cache) ResponseChan(key string, retriever Retriever) <-chan Response

ResponseChan opens or returns channel for the cache response.

type Response

type Response struct {
	Value interface{}
	Error error
}

Response stores value and/or error returned by the channel.

type Retriever

type Retriever func(string) (interface{}, error)

Retriever is a function to retrieve value not already cached.

Jump to

Keyboard shortcuts

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