gocache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 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[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache[K comparable, V any](partitionSize, totalPartitions int, cacheExpiry time.Duration) *Cache[K, V]

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(k K, getter func() (*V, error)) (*V, error)

func (*Cache[K, V]) HasKey

func (c *Cache[K, V]) HasKey(k K) (bool, error)

type Promise

type Promise[V any] struct {
	// contains filtered or unexported fields
}

func NewPromise

func NewPromise[V any]() *Promise[V]

func (*Promise[V]) Reject

func (p *Promise[V]) Reject(err error)

func (*Promise[V]) Resolve

func (p *Promise[V]) Resolve(v *V)

func (*Promise[V]) Wait

func (p *Promise[V]) Wait() (*V, error)

Jump to

Keyboard shortcuts

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