memorycache

package
v1.2.2-yidao Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) 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