Cache clear programmatically

I am doing some benchmarking and want to programmatically clear all cached IO/data. What is a reliable way to do this?

My guess: the tile cache is associated with a context, and if I create a new context I have an empty tile/IO cache?

Yes, the tile cache is associated with a context. You can explicitly create a new context in TileDB-Py, instead of using the global one, which will start with an empty cache. Moreover, you can set the "sm.tile_cache_size" parameter to 0 in the new context if you don’t want to use any tile caching.