This commit is contained in:
aozhiwei 2024-06-15 21:05:32 +08:00
parent 9b3c2d3b07
commit 5698e36b05
2 changed files with 18 additions and 6 deletions

View File

@ -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 {
}
}
}

View File

@ -43,7 +43,7 @@ type StreamPagination struct {
}
type NftCache interface {
GetRawData() string
}
type NftDto struct {