cache

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 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 SegmentCache

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

SegmentCache provides an LRU cache keyed by topic/partition/baseOffset storing segment bytes.

func NewSegmentCache

func NewSegmentCache(capacityBytes int) *SegmentCache

NewSegmentCache creates a cache with capacity in bytes.

func (*SegmentCache) GetSegment

func (c *SegmentCache) GetSegment(topic string, partition int32, baseOffset int64) ([]byte, bool)

GetSegment returns cached data if present.

func (*SegmentCache) SetSegment

func (c *SegmentCache) SetSegment(topic string, partition int32, baseOffset int64, data []byte)

SetSegment adds or updates a cache entry.

Jump to

Keyboard shortcuts

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