in_memory_cache

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 9 Imported by: 0

README

in_memory_cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparable

type Comparable interface {
	ComparisonValue() int64
}

type InMemoryCache

type InMemoryCache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](ctx context.Context, ttl time.Duration, maxCount int32, maxSize int64) (*InMemoryCache[T], error)

func (*InMemoryCache[T]) Add

func (c *InMemoryCache[T]) Add(key string, data T, ttl ...time.Duration)

func (*InMemoryCache[T]) Get

func (c *InMemoryCache[T]) Get(key string) (T, bool)

type SortedSlice

type SortedSlice[T Comparable] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SortedSlice[T]) Add

func (s *SortedSlice[T]) Add(val T)

func (*SortedSlice[T]) Check

func (s *SortedSlice[T]) Check() bool

func (*SortedSlice[T]) Get

func (s *SortedSlice[T]) Get(i int) *T

func (*SortedSlice[T]) Len

func (s *SortedSlice[T]) Len() int

func (*SortedSlice[T]) Remove

func (s *SortedSlice[T]) Remove(val T)

func (*SortedSlice[T]) RemoveByIndex

func (s *SortedSlice[T]) RemoveByIndex(i int)

func (*SortedSlice[T]) Sort

func (s *SortedSlice[T]) Sort()

type SyncMap

type SyncMap[T comparable, D any] struct {
	// contains filtered or unexported fields
}

func NewSyncMap

func NewSyncMap[T comparable, D any]() SyncMap[T, D]

func (*SyncMap[T, D]) Add

func (s *SyncMap[T, D]) Add(key T, value D)

func (*SyncMap[T, D]) Contains

func (s *SyncMap[T, D]) Contains(key T) bool

func (*SyncMap[T, D]) Get

func (s *SyncMap[T, D]) Get(key T) (D, bool)

func (*SyncMap[T, D]) Remove

func (s *SyncMap[T, D]) Remove(key T)

Jump to

Keyboard shortcuts

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