Standardised directory constants in the Cache class.
Improvements to Cache class.

- Don't repeat the calculation of the SHA1 hash for an object ID
  unnecessarily.
- Check to see whether or not a cache object has expired yet. Doesn't
  yet actually evict said object from the cache.