Adds support for clear() command.

Adds support for clear() command.
Moved initialization of cache to it's own method that is called by both clear() and initialize().
Added tests for clear().
All existing tests pass.