Help us shape the future of Go! Take the 2026 Go Developer Survey

blobcache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT-0 Imports: 2 Imported by: 0

Documentation

Overview

Package blobcache provides a bounded in-memory LRU for raw message bodies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a concurrency-safe byte-bounded LRU.

func New

func New(max int64) *Cache

New returns a cache with the given byte budget. A non-positive budget disables caching.

func (*Cache) Get

func (c *Cache) Get(key string) ([]byte, bool)

Get returns a cached body and marks it recently used.

func (*Cache) Put

func (c *Cache) Put(key string, body []byte)

Put stores body under key, evicting least-recently-used entries as needed.

func (*Cache) Used

func (c *Cache) Used() int64

Used returns the current cached byte count.

Jump to

Keyboard shortcuts

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