Introducing CacheManager

There's a reason I did this a long time ago, which I don't remember (I don't think we had ```long``` support at the time, maybe). I'll revisit and rework this bit.