memorycache

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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),
	allocator malloc.Allocator,
) *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) Release added in v1.2.1

func (d *Data) Release()

func (*Data) Slice added in v1.2.1

func (d *Data) 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