Caching of files on the IPFS network

In some of the early test I’ve done in hosting my own IPFS server, I’ve noticed that the files are still available through the gateway for a while even after I shut down the server. Do files get cached out there on the nodes after someone loads them through the gateway?

I’m just trying to get a better understanding of how IPFS works. Wondering if this has something to do with garbage collection, or something else like some other node pinning the content.

When someone requests content through the gateway it gets cached in the IPFS datastore on the gateway node. This content will continue to be cached on the node until garbage collection comes along and cleans it up.

If there are any other nodes that have requested the content and remain online after you turn off your node, those nodes might also result in the content being available even when your node is offline.

If someone happens to pin the content on their node, then that content will not be cleaned up when/if garbage collection runs on their node.

1 Like

Thanks for the response! Exactly as I suspected.