storage

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage interface {
	Load(key string) int64
	Increment(key string)
	Save(key string, v int64)
	ReadFromFile(fileMap string) error
	WriteToFile(fileMap string) error
}

type SyncMap added in v1.1.7

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

SyncMap provides a thread-safe map with file persistence capabilities

func NewSyncMap

func NewSyncMap() *SyncMap

NewSyncMap creates a new thread-safe map instance

func (*SyncMap) Increment added in v1.1.7

func (c *SyncMap) Increment(key string)

Increment increases the value for the given key by 1

func (*SyncMap) Load added in v1.1.7

func (c *SyncMap) Load(key string) int64

Load retrieves the value for the given key

func (*SyncMap) ReadFromFile added in v1.1.7

func (c *SyncMap) ReadFromFile(fileMap string) error

ReadFromFile loads the map data from a JSON file

func (*SyncMap) Save added in v1.1.7

func (c *SyncMap) Save(key string, v int64)

Save sets the value for the given key

func (*SyncMap) WriteToFile added in v1.1.7

func (c *SyncMap) WriteToFile(fileMap string) error

WriteToFile saves the map data to a JSON file

Jump to

Keyboard shortcuts

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