Are NFTs cached on the server?

Iā€™ve noticed some variance when fetching NFTs (eg, Moralis.Web3API.account.getNFTs(options)) - are the results from a previous getNFT call cached, or is it considered fresh each time?

Thanks

What is the difference that you observed? Metadata for nfts is cached.

Is there a way I can clear the cache, to see how it would perform on the first load?

What is the difference that you observed? Caching shouldnā€™t be something that creates you problems.

Well I was grabbing the NFTs and then performing some operations on them, and logging the performance before and after, and noticed that in some cases it would take longer than usual. Now Iā€™m logging how long Moralis takes to fetch and comparing my operations on them to see where the issue lies, but I canā€™t seem to replicate the issue, hence why Iā€™d like to clear the cache to test

Also, for an address Iā€™m testing, Moralis is only returning 49 of the 57 available NFTs (theyā€™re all available on OpenSea). Could this be a caching issue?

Opensea can have lazy minted nfts, or there are contracts that we donā€™t track yet. We start to track a new nft contract when getTokenIdMetadata is called first time for that contract.
For caching, sometimes it takes longer, sometimes it is faster, usually if you do same request at small time interval the second time may be from caching and it may be faster.

The NFTs not being included are of the same contract as other NFTs that are included, during the fetch

In this specific case, itā€™s the OPENSTORE contract (0x88B48F654c30e99bc2e4A1559b4Dcf1aD93FA656), I believe this is executed when a token is minted on Rinkeby through the OpenSea minting interface

Only 1 is being included though, the other 8 seem to be missing

that 0x88B48F654c30e99bc2e4A1559b4Dcf1aD93FA656 looks like a marketplace contract for opensea

When you mint a token on the OpenSea testnet, thatā€™s the contract OpenSea uses (it seems to use a a ERC1155 contract for the mainnet too). ERC1155 is compatible with NFTs, and so Moralis should be able to pull, right? getNFTs even returns one of them (but not the rest), any idea why?

If Moralis canā€™t pull, then are NFTs minted on OpenSea directly just unreachable using Moralis?

can you give an example of an NFT that is on blockchain for that contract and is not found on Moralis?

https://testnets.opensea.io/assets/0x88b48f654c30e99bc2e4a1559b4dcf1ad93fa656/52417189881859156248873058615346123927850392283104709581153483359385357910017

Metadata Editable that means that there was not transaction on chain and that NFT is only a lazy minted nft.
Can you point me to the transaction on chain that minted that NFT?

Oh okay, I see. I didnā€™t realize itā€™s offchain upon initial mint. If I freeze the metadata, will that trigger an on-chain transaction?

I donā€™t know, usually on a transfer or sell it will do that mint on chain

I think you may be right. The one token that did show up says the metadata is ā€œCentralizedā€ rather than ā€œFrozenā€. I couldnā€™t find any documentation on what that meant though. Iā€™m guessing itā€™s triggered by a sell/transfer of an unfrozen token?

Anyway, thanks for the help

It seems that Moralis API is useless if your tokenUri is updated laterā€¦ it will NOT ever reflect in your Moralis calls. :sob:

You can update it manually with reSyncMetadata.

Outside of the scenarios outlined here, it wonā€™t update automatically because it would be far too intensive and wasteful to re-check all NFTs again if their token_uri is potentially updated or not.