cache

package
v0.0.0-...-359b95b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[T pointable] struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache[T pointable](size int, itemGenerator func() T) *Cache[T]

func (*Cache[T]) Add

func (c *Cache[T]) Add(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) AddF

func (c *Cache[T]) AddF(ptr allocator.Pointable, flag LOCKMODE) Pointable[T]

func (*Cache[T]) AddR

func (c *Cache[T]) AddR(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) AddW

func (c *Cache[T]) AddW(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) Clear

func (c *Cache[T]) Clear()

func (*Cache[T]) Del

func (c *Cache[T]) Del(ptr allocator.Pointable)

func (*Cache[T]) Flush

func (c *Cache[T]) Flush()

func (*Cache[T]) Get

func (c *Cache[T]) Get(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) GetF

func (c *Cache[T]) GetF(ptr allocator.Pointable, flag LOCKMODE) Pointable[T]

func (*Cache[T]) GetR

func (c *Cache[T]) GetR(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) GetSet

func (c *Cache[T]) GetSet(ptr allocator.Pointable) Pointable[T]

func (*Cache[T]) GetW

func (c *Cache[T]) GetW(ptr allocator.Pointable) Pointable[T]

type Dirtyable

type Dirtyable interface {
	IsDirty() bool
	Dirty(v bool)
}

type LOCKMODE

type LOCKMODE int
const (
	NONE LOCKMODE = iota
	READ
	WRITE
)

type Pointable

type Pointable[T pointable] interface {
	RLock() *pointerWrapper[T]
	RUnlock() *pointerWrapper[T]
	Lock() *pointerWrapper[T]
	Unlock() *pointerWrapper[T]
	LockFlag(flag LOCKMODE) *pointerWrapper[T]
	UnlockFlag(flag LOCKMODE) *pointerWrapper[T]
	New() T
	Get() T
	Set(val T) *pointerWrapper[T]
	Flush() *pointerWrapper[T]
	Ptr() allocator.Pointable
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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