1
This commit is contained in:
parent
d6f8ed4836
commit
d706ab1384
50
server/marketserver/cache/cachemgr.go
vendored
50
server/marketserver/cache/cachemgr.go
vendored
@ -47,31 +47,37 @@ func (this *cacheMgr) fastGetNft(dto *common.NftDto) {
|
|||||||
|
|
||||||
func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
||||||
key := dto.GetKey()
|
key := dto.GetKey()
|
||||||
|
if p, ok := this.nftHash.Load(key); ok {
|
||||||
|
if q5.GetTickCount() - (*p).refreshTick < 1000 * 15 {
|
||||||
|
dto.NftCache = *p
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.nftHash.Delete(key)
|
||||||
|
if !f5.IsOnlineEnv() {
|
||||||
|
f5.GetSysLog().Warning("remove cache %s", dto.TokenId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l := f5.AllocLock(key)
|
||||||
|
defer f5.ReleaseLock(l)
|
||||||
if p, ok := this.nftHash.Load(key); ok {
|
if p, ok := this.nftHash.Load(key); ok {
|
||||||
dto.NftCache = *p
|
dto.NftCache = *p
|
||||||
} else {
|
} else {
|
||||||
l := f5.AllocLock(key)
|
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||||
defer f5.ReleaseLock(l)
|
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||||
if p, ok := this.nftHash.Load(key); ok {
|
map[string]string{
|
||||||
dto.NftCache = *p
|
"c": "OutAppNft",
|
||||||
} else {
|
"a": "nftDetailByContractAddress",
|
||||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
"contract_address": dto.ContractAddress,
|
||||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
"net_id": q5.ToString(dto.NetId),
|
||||||
map[string]string{
|
"token_id": dto.TokenId,
|
||||||
"c": "OutAppNft",
|
},
|
||||||
"a": "nftDetailByContractAddress",
|
func (rsp f5.HttpCliResponse) {
|
||||||
"contract_address": dto.ContractAddress,
|
if rsp.GetErr() == nil {
|
||||||
"net_id": q5.ToString(dto.NetId),
|
jsonRsp := map[string]interface{}{}
|
||||||
"token_id": dto.TokenId,
|
q5.DecodeJson(rsp.GetRawData(), &jsonRsp)
|
||||||
},
|
dto.NftCache = this.addNft(dto.NetId, dto.ContractAddress, dto.TokenId, jsonRsp)
|
||||||
func (rsp f5.HttpCliResponse) {
|
}
|
||||||
if rsp.GetErr() == nil {
|
})
|
||||||
jsonRsp := map[string]interface{}{}
|
|
||||||
q5.DecodeJson(rsp.GetRawData(), &jsonRsp)
|
|
||||||
dto.NftCache = this.addNft(dto.NetId, dto.ContractAddress, dto.TokenId, jsonRsp)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user