mapserver/mapblockaccessor/update.go

15 lines
317 B
Go
Raw Normal View History

2019-02-10 22:27:53 +03:00
package mapblockaccessor
import (
2023-12-29 18:00:11 +03:00
"mapserver/types"
2019-02-10 22:27:53 +03:00
2021-10-12 08:44:07 +03:00
"github.com/minetest-go/mapparser"
2019-02-10 22:27:53 +03:00
cache "github.com/patrickmn/go-cache"
)
2023-12-29 18:00:11 +03:00
func (a *MapBlockAccessor) Update(pos *types.MapBlockCoords, mb *mapparser.MapBlock) {
2019-02-10 22:27:53 +03:00
key := getKey(pos)
2019-03-13 12:41:37 +03:00
cacheBlockCount.Inc()
a.blockcache.Set(key, mb, cache.DefaultExpiration)
2019-02-10 22:27:53 +03:00
}