cache

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 5 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 {
	Root string
}

func DefaultCache

func DefaultCache() *Cache

func (*Cache) Clear

func (c *Cache) Clear() error

func (*Cache) Do

func (c *Cache) Do(key string, do func() (string, error), ttl time.Duration) (string, error)

func (*Cache) GetOrDo

func (c *Cache) GetOrDo(key string, do func() (string, error), ttl time.Duration) (string, error)

func (*Cache) Put

func (c *Cache) Put(key string, value string, ttl time.Duration) (string, error)

type CacheEntry

type CacheEntry struct {
	Expire time.Time `json:"e"`
	Value  string    `json:"v"`
}

Jump to

Keyboard shortcuts

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