Add functions for purge and creating the cache.
Cleanup code.