1
This commit is contained in:
parent
9b3c2d3b07
commit
5698e36b05
22
server/marketserver/cache/cachemgr.go
vendored
22
server/marketserver/cache/cachemgr.go
vendored
@ -1,7 +1,9 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"sync"
|
||||
"fmt"
|
||||
"main/common"
|
||||
)
|
||||
|
||||
@ -18,12 +20,22 @@ func (this *cacheMgr) UnInit() {
|
||||
}
|
||||
|
||||
func (this *cacheMgr) GetNfts(nfts []*common.NftDto) {
|
||||
/*
|
||||
for _, val := range nfts {
|
||||
|
||||
}*/
|
||||
this.internalGetNft(val)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *cacheMgr) internalGetNft(netId int32, contractAddress string, tokenId string) *nft {
|
||||
return nil
|
||||
func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
||||
key := fmt.Sprintf("%d_%s_%s", dto.NetId, dto.ContractAddress, dto.TokenId)
|
||||
if p, ok := this.nftHash.Load(key); ok {
|
||||
dto.NftCache = p.(*nft)
|
||||
} else {
|
||||
l := f5.AllocLock(key)
|
||||
defer f5.ReleaseLock(l)
|
||||
if p, ok := this.nftHash.Load(key); ok {
|
||||
dto.NftCache = p.(*nft)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ type StreamPagination struct {
|
||||
}
|
||||
|
||||
type NftCache interface {
|
||||
|
||||
GetRawData() string
|
||||
}
|
||||
|
||||
type NftDto struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user