globalregistry

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

README

全局资源缓存器

主要用来当成一个缓存数据库用。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentMap

type ConcurrentMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewConcurrentMap

func NewConcurrentMap() *ConcurrentMap

func (*ConcurrentMap) Delete

func (m *ConcurrentMap) Delete(key string)

func (*ConcurrentMap) Get

func (m *ConcurrentMap) Get(key string) (interface{}, bool)

func (*ConcurrentMap) Keys

func (m *ConcurrentMap) Keys() []string

func (*ConcurrentMap) Set

func (m *ConcurrentMap) Set(key string, value interface{})

type GlobalRegistry

type GlobalRegistry struct {
	Registry   *ConcurrentMap
	RingBuffer *RingBuffer
	TimerWheel *TimerWheel
}

func NewGlobalRegistry

func NewGlobalRegistry() *GlobalRegistry

type RingBuffer

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

RingBuffer 是环形缓冲区结构体

func NewRingBuffer

func NewRingBuffer(size int) *RingBuffer

NewRingBuffer 创建一个新的环形缓冲区

func (*RingBuffer) Read

func (rb *RingBuffer) Read() (byte, error)

Read 从环形缓冲区读取数据

func (*RingBuffer) Write

func (rb *RingBuffer) Write(data []byte) (int, error)

Write 向环形缓冲区写入数据

type TimerWheel

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

func NewTimerWheel

func NewTimerWheel(interval time.Duration, size int) *TimerWheel

func (*TimerWheel) AddTimer

func (tw *TimerWheel) AddTimer(d time.Duration, f func())

func (*TimerWheel) Run

func (tw *TimerWheel) Run()

func (*TimerWheel) Stop

func (tw *TimerWheel) Stop()

Jump to

Keyboard shortcuts

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