cache

package
v0.0.0-...-b9a9d18 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty uint64 = iota
	QueryIsPending
	DataIsAvailable
)

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryCache

type QueryCache struct {
	// contains filtered or unexported fields
}

func NewQueryCache

func NewQueryCache(queryCacheSizeMB uint64, expireTime int32) *QueryCache

func (*QueryCache) GetQueryItem

func (q *QueryCache) GetQueryItem(k string) *QueryItem

TODO: Make size and expire configurable

type QueryItem

type QueryItem struct {
	sync.RWMutex
	Key           string
	Data          atomic.Value
	Flags         uint64 // DataIsAvailable or QueryIsPending
	QueryFinished chan struct{}
	// contains filtered or unexported fields
}

func (*QueryItem) FetchOrLock

func (q *QueryItem) FetchOrLock(ctx context.Context) (interface{}, bool)

func (*QueryItem) GetStatus

func (q *QueryItem) GetStatus() uint64

func (*QueryItem) StoreAbort

func (q *QueryItem) StoreAbort()

func (*QueryItem) StoreAndUnlock

func (q *QueryItem) StoreAndUnlock(data interface{}, size uint64)

Jump to

Keyboard shortcuts

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