reference

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CachePrefix = "cache/"
View Source
const RefPrefix = "ref/"

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheSet

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

func NewCacheSet

func NewCacheSet(db *uleveldb.ULevelDB) *CacheSet

func (*CacheSet) Add

func (s *CacheSet) Add(key string) error

func (*CacheSet) AllKeysChan

func (s *CacheSet) AllKeysChan(ctx context.Context) (<-chan string, error)

func (*CacheSet) Has

func (s *CacheSet) Has(key string) (bool, error)

func (*CacheSet) Remove

func (s *CacheSet) Remove(key string) error

type RefCounter

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

func NewRefCounter

func NewRefCounter(db *uleveldb.ULevelDB, cacheSet *CacheSet) *RefCounter

func (*RefCounter) AllKeysChan

func (rc *RefCounter) AllKeysChan(ctx context.Context, count int64) (<-chan string, error)

AllKeysChan query keys which reference count value equals count param

func (*RefCounter) Decr

func (rc *RefCounter) Decr(key string) error

func (*RefCounter) Get

func (rc *RefCounter) Get(key string) (int64, error)

func (*RefCounter) Has

func (rc *RefCounter) Has(key string) (bool, error)

func (*RefCounter) Incr

func (rc *RefCounter) Incr(key string) error

func (*RefCounter) IncrOrCreate

func (rc *RefCounter) IncrOrCreate(key string, createFunc func() error) error

func (*RefCounter) Remove

func (rc *RefCounter) Remove(key string, force bool) error

Remove remove zero reference counter

Jump to

Keyboard shortcuts

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