memorycache

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnableTracing = false

Functions

This section is empty.

Types

type Cache added in v1.2.0

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

func NewCache added in v1.2.0

func NewCache(
	capacity int64,
	postSet func(key cache.CacheKey, value CacheData),
	postGet func(key cache.CacheKey, value CacheData),
	postEvict func(key cache.CacheKey, value CacheData),
) *Cache

func (*Cache) Alloc added in v1.2.0

func (c *Cache) Alloc(n int) CacheData

func (*Cache) Available added in v1.2.0

func (c *Cache) Available() int64

func (*Cache) Capacity added in v1.2.0

func (c *Cache) Capacity() int64

func (*Cache) DeletePaths added in v1.2.0

func (c *Cache) DeletePaths(_ context.Context, _ []string)

func (*Cache) Flush added in v1.2.0

func (c *Cache) Flush()

func (*Cache) Get added in v1.2.0

func (c *Cache) Get(ctx context.Context, key cache.CacheKey) (CacheData, bool)

func (*Cache) Set added in v1.2.0

func (c *Cache) Set(ctx context.Context, key cache.CacheKey, value CacheData) error

func (*Cache) Size added in v1.2.0

func (c *Cache) Size() int64

func (*Cache) Used added in v1.2.0

func (c *Cache) Used() int64

type CacheData added in v1.2.0

type CacheData interface {
	Bytes() []byte
	Slice(length int) CacheData
	Release()
}

type Data

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

Data is a reference counted byte buffer

func (*Data) Buf

func (d *Data) Buf() []byte

Buf returns the underlying buffer of the Data

func (*Data) Bytes added in v1.2.0

func (d *Data) Bytes() []byte

func (*Data) Truncate

func (d *Data) Truncate(n int) *Data

type RCBytes

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

RCBytes represents a reference counting data from cache it is immutable, caller should not modify it and call Release after use

func (RCBytes) Bytes

func (r RCBytes) Bytes() []byte

func (RCBytes) Release

func (r RCBytes) Release()

func (RCBytes) Slice

func (r RCBytes) Slice(n int) CacheData

Directories

Path Synopsis
checks

Jump to

Keyboard shortcuts

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