cacheable

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacheable

type Cacheable interface {
	GetTimestamp() string
	SetTimestamp(timestamp string)

	GetSortedKeys() *[]string

	// GetEntryRef obtains the reference to the current entry, or nil if the key isn't present.
	GetEntryRef(key string) *interface{}

	// UpdateEntryRef will create the key if it doesn't exist
	// if newRef is nil, will remove the key if present
	//
	// key changes lead to re-creating the sorted keys cache
	UpdateEntryRef(key string, newRef *interface{})
}

Cacheable implements a synchronized in-memory cache for references to arbitrary data structures

Update the timestamp whenever you do a full rescan.

func New

func New() Cacheable

type Impl

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

func (*Impl) GetEntryRef

func (c *Impl) GetEntryRef(key string) *interface{}

func (*Impl) GetSortedKeys

func (c *Impl) GetSortedKeys() *[]string

func (*Impl) GetTimestamp

func (c *Impl) GetTimestamp() string

func (*Impl) SetTimestamp

func (c *Impl) SetTimestamp(timestamp string)

func (*Impl) UpdateEntryRef

func (c *Impl) UpdateEntryRef(key string, newRef *interface{})

Jump to

Keyboard shortcuts

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