artifactcache.py: make cleanup clean by object rather than by ref

This makes cleanup much faster

Fixes #734
2 files changed