index: add more debug() calls, store the `cache` reference