cache

package
v5.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityCache

type EntityCache struct {
	Soldiers map[uint16]model.Soldier
	Vehicles map[uint16]model.Vehicle
	// contains filtered or unexported fields
}

EntityCache caches soldiers and vehicles when they are created to avoid subsequent db reads. Latency in these calls is critical to quickly process incoming data.

func NewEntityCache

func NewEntityCache() *EntityCache

func (*EntityCache) AddSoldier

func (c *EntityCache) AddSoldier(s model.Soldier)

func (*EntityCache) AddVehicle

func (c *EntityCache) AddVehicle(v model.Vehicle)

func (*EntityCache) GetSoldier

func (c *EntityCache) GetSoldier(id uint16) (model.Soldier, bool)

func (*EntityCache) GetVehicle

func (c *EntityCache) GetVehicle(id uint16) (model.Vehicle, bool)

func (*EntityCache) Lock

func (c *EntityCache) Lock()

func (*EntityCache) Reset

func (c *EntityCache) Reset()

func (*EntityCache) Unlock

func (c *EntityCache) Unlock()

type MarkerCache

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

MarkerCache maps marker names to their database IDs for the current mission

func NewMarkerCache

func NewMarkerCache() *MarkerCache

NewMarkerCache creates a new MarkerCache

func (*MarkerCache) Delete

func (c *MarkerCache) Delete(name string)

Delete removes a marker by name

func (*MarkerCache) Get

func (c *MarkerCache) Get(name string) (uint, bool)

Get retrieves a marker ID by name

func (*MarkerCache) Reset

func (c *MarkerCache) Reset()

Reset clears all markers from the cache

func (*MarkerCache) Set

func (c *MarkerCache) Set(name string, id uint)

Set stores a marker ID by name

type SafeCounter

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

SafeCounter is a thread-safe counter

func (*SafeCounter) Inc

func (c *SafeCounter) Inc()

func (*SafeCounter) Set

func (c *SafeCounter) Set(v int)

func (*SafeCounter) Value

func (c *SafeCounter) Value() int

Jump to

Keyboard shortcuts

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