1
This commit is contained in:
parent
8b75a36150
commit
e109c6fbe6
7
server/marketserver/cache/cachemgr.go
vendored
7
server/marketserver/cache/cachemgr.go
vendored
@ -4,13 +4,12 @@ import (
|
|||||||
"q5"
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
"mt"
|
"mt"
|
||||||
"sync"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"main/common"
|
"main/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cacheMgr struct {
|
type cacheMgr struct {
|
||||||
nftHash sync.Map //net_id contract_address token_id -> nft
|
nftHash *q5.ConcurrentMap[string, *nft] //net_id contract_address token_id -> nft
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *cacheMgr) Init() {
|
func (this *cacheMgr) Init() {
|
||||||
@ -30,12 +29,12 @@ func (this *cacheMgr) GetNfts(nfts []*common.NftDto) {
|
|||||||
func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
||||||
key := fmt.Sprintf("%d_%s_%s", dto.NetId, dto.ContractAddress, dto.TokenId)
|
key := fmt.Sprintf("%d_%s_%s", dto.NetId, dto.ContractAddress, dto.TokenId)
|
||||||
if p, ok := this.nftHash.Load(key); ok {
|
if p, ok := this.nftHash.Load(key); ok {
|
||||||
dto.NftCache = p.(*nft)
|
dto.NftCache = *p
|
||||||
} else {
|
} else {
|
||||||
l := f5.AllocLock(key)
|
l := f5.AllocLock(key)
|
||||||
defer f5.ReleaseLock(l)
|
defer f5.ReleaseLock(l)
|
||||||
if p, ok := this.nftHash.Load(key); ok {
|
if p, ok := this.nftHash.Load(key); ok {
|
||||||
dto.NftCache = p.(*nft)
|
dto.NftCache = *p
|
||||||
} else {
|
} else {
|
||||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ee715d672d83932a6a20f810cc490d737fad01e6
|
Subproject commit 550a64387e2d163b99ea39bbf48500bba998676e
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9048589a4ddb6d7432350a2030f8445b9fac7d83
|
Subproject commit 47f75d8247df848d50ba0e763c41dd6554a8b758
|
Loading…
x
Reference in New Issue
Block a user