Support multiple cache instances

Closes #1149