24 lines
327 B
Go
24 lines
327 B
Go
package cache
|
|
|
|
import (
|
|
"jannex/robot-control-manager/modules/structs"
|
|
"sync"
|
|
)
|
|
|
|
var robots []*structs.Robot
|
|
var rMu sync.RWMutex
|
|
|
|
func AddRobot(robot *structs.Robot) {
|
|
rMu.Lock()
|
|
defer rMu.Unlock()
|
|
|
|
robots = append(robots, robot)
|
|
}
|
|
|
|
func GetRobots() []*structs.Robot {
|
|
rMu.RLock()
|
|
defer rMu.RUnlock()
|
|
|
|
return robots
|
|
}
|