Loading server/runtime_javascript_localcache.go +4 −6 Original line number Diff line number Diff line Loading @@ -16,29 +16,27 @@ package server import ( "sync" "github.com/dop251/goja" ) type RuntimeJavascriptLocalCache struct { sync.RWMutex data map[string]goja.Value data map[string]interface{} } func NewRuntimeJavascriptLocalCache() *RuntimeJavascriptLocalCache { return &RuntimeJavascriptLocalCache{ data: make(map[string]goja.Value), data: make(map[string]interface{}), } } func (lc *RuntimeJavascriptLocalCache) Get(key string) (goja.Value, bool) { func (lc *RuntimeJavascriptLocalCache) Get(key string) (interface{}, bool) { lc.RLock() value, found := lc.data[key] lc.RUnlock() return value, found } func (lc *RuntimeJavascriptLocalCache) Put(key string, value goja.Value) { func (lc *RuntimeJavascriptLocalCache) Put(key string, value interface{}) { lc.Lock() lc.data[key] = value lc.Unlock() Loading server/runtime_javascript_nakama.go +4 −4 Original line number Diff line number Diff line Loading @@ -7290,11 +7290,11 @@ func (n *runtimeJavascriptNakamaModule) localcacheGet(r *goja.Runtime) func(goja } value, found := n.localCache.Get(key) if found { return value if !found { return defVal } return defVal return r.ToValue(value) } } Loading @@ -7310,7 +7310,7 @@ func (n *runtimeJavascriptNakamaModule) localcachePut(r *goja.Runtime) func(goja panic(r.NewTypeError("expects a non empty value")) } n.localCache.Put(key, value) n.localCache.Put(key, value.Export()) return goja.Undefined() } Loading Loading
server/runtime_javascript_localcache.go +4 −6 Original line number Diff line number Diff line Loading @@ -16,29 +16,27 @@ package server import ( "sync" "github.com/dop251/goja" ) type RuntimeJavascriptLocalCache struct { sync.RWMutex data map[string]goja.Value data map[string]interface{} } func NewRuntimeJavascriptLocalCache() *RuntimeJavascriptLocalCache { return &RuntimeJavascriptLocalCache{ data: make(map[string]goja.Value), data: make(map[string]interface{}), } } func (lc *RuntimeJavascriptLocalCache) Get(key string) (goja.Value, bool) { func (lc *RuntimeJavascriptLocalCache) Get(key string) (interface{}, bool) { lc.RLock() value, found := lc.data[key] lc.RUnlock() return value, found } func (lc *RuntimeJavascriptLocalCache) Put(key string, value goja.Value) { func (lc *RuntimeJavascriptLocalCache) Put(key string, value interface{}) { lc.Lock() lc.data[key] = value lc.Unlock() Loading
server/runtime_javascript_nakama.go +4 −4 Original line number Diff line number Diff line Loading @@ -7290,11 +7290,11 @@ func (n *runtimeJavascriptNakamaModule) localcacheGet(r *goja.Runtime) func(goja } value, found := n.localCache.Get(key) if found { return value if !found { return defVal } return defVal return r.ToValue(value) } } Loading @@ -7310,7 +7310,7 @@ func (n *runtimeJavascriptNakamaModule) localcachePut(r *goja.Runtime) func(goja panic(r.NewTypeError("expects a non empty value")) } n.localCache.Put(key, value) n.localCache.Put(key, value.Export()) return goja.Undefined() } Loading