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) {
|
||||
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 {
|
||||
dto.NftCache = *p
|
||||
} else {
|
||||
l := f5.AllocLock(key)
|
||||
defer f5.ReleaseLock(l)
|
||||
if p, ok := this.nftHash.Load(key); ok {
|
||||
dto.NftCache = *p
|
||||
} else {
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftDetailByContractAddress",
|
||||
"contract_address": dto.ContractAddress,
|
||||
"net_id": q5.ToString(dto.NetId),
|
||||
"token_id": dto.TokenId,
|
||||
},
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftDetailByContractAddress",
|
||||
"contract_address": dto.ContractAddress,
|
||||
"net_id": q5.ToString(dto.NetId),
|
||||
"token_id": dto.TokenId,
|
||||
},
|
||||
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