Restore functionality of edits, deletes and boundedmap uses UUID now
All checks were successful
Build & Release / build-latest (push) Successful in 9m50s
Build & Release / version-release (push) Has been skipped

This commit is contained in:
Salastil
2026-02-28 21:26:45 -05:00
parent 4b455eb58e
commit 85de6d175f
4 changed files with 65 additions and 71 deletions

View File

@@ -7,24 +7,24 @@ import (
type BoundedMap struct {
mu sync.RWMutex
data map[int]interface{}
timestamps map[int]time.Time
data map[string]interface{}
timestamps map[string]time.Time
maxSize int
maxAge time.Duration
keys []int
keys []string
}
func NewBoundedMap(maxSize int, maxAge time.Duration) *BoundedMap {
return &BoundedMap{
data: make(map[int]interface{}),
timestamps: make(map[int]time.Time),
data: make(map[string]interface{}),
timestamps: make(map[string]time.Time),
maxSize: maxSize,
maxAge: maxAge,
keys: make([]int, 0, maxSize),
keys: make([]string, 0, maxSize),
}
}
func (bm *BoundedMap) Set(key int, value interface{}) {
func (bm *BoundedMap) Set(key string, value interface{}) {
bm.mu.Lock()
defer bm.mu.Unlock()
if _, ok := bm.data[key]; ok {
@@ -50,14 +50,14 @@ func (bm *BoundedMap) Set(key int, value interface{}) {
}
}
func (bm *BoundedMap) Get(key int) (interface{}, bool) {
func (bm *BoundedMap) Get(key string) (interface{}, bool) {
bm.mu.RLock()
defer bm.mu.RUnlock()
v, ok := bm.data[key]
return v, ok
}
func (bm *BoundedMap) Delete(key int) {
func (bm *BoundedMap) Delete(key string) {
bm.mu.Lock()
defer bm.mu.Unlock()
delete(bm.data, key)