1
This commit is contained in:
parent
e109c6fbe6
commit
74446ec857
2
server/marketserver/cache/cachemgr.go
vendored
2
server/marketserver/cache/cachemgr.go
vendored
@ -13,7 +13,7 @@ type cacheMgr struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *cacheMgr) Init() {
|
func (this *cacheMgr) Init() {
|
||||||
|
this.nftHash = new(q5.ConcurrentMap[string, *nft])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *cacheMgr) UnInit() {
|
func (this *cacheMgr) UnInit() {
|
||||||
|
@ -3,7 +3,6 @@ package mt
|
|||||||
import (
|
import (
|
||||||
"f5"
|
"f5"
|
||||||
"mtb"
|
"mtb"
|
||||||
"sync"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,7 +12,6 @@ type Contract struct {
|
|||||||
|
|
||||||
type ContractTable struct {
|
type ContractTable struct {
|
||||||
f5.NameMetaTable[Contract]
|
f5.NameMetaTable[Contract]
|
||||||
itemHash sync.Map //string => Contract
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Contract) Init1() {
|
func (this *Contract) Init1() {
|
||||||
|
@ -3,30 +3,28 @@ package mt
|
|||||||
import (
|
import (
|
||||||
"f5"
|
"f5"
|
||||||
"mtb"
|
"mtb"
|
||||||
"sync"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Item struct {
|
type Item struct {
|
||||||
mtb.Item
|
mtb.Item
|
||||||
|
lowerName string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ItemTable struct {
|
type ItemTable struct {
|
||||||
f5.IdMetaTable[Item]
|
f5.IdMetaTable[Item]
|
||||||
itemHash sync.Map //string => item_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Item) Init1() {
|
func (this *Item) Init1() {
|
||||||
Table.Item.itemHash.Store(strings.ToLower(this.GetName()), this.GetItemId())
|
this.lowerName = strings.ToLower(this.GetName())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ItemTable) Search(name string, itemIds map[int32]int32) {
|
func (this *ItemTable) Search(name string, itemIds map[int32]int32) {
|
||||||
name = strings.ToLower(name)
|
name = strings.ToLower(name)
|
||||||
this.itemHash.Range(
|
this.Traverse(
|
||||||
func (k, v interface{}) bool {
|
func (ele *Item) bool {
|
||||||
key := k.(string)
|
if strings.Contains(ele.lowerName, name) {
|
||||||
if strings.Contains(key, name) {
|
itemIds[ele.GetItemId()] = 1
|
||||||
itemIds[v.(int32)] = 1
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user