MDL-40903 cache: Unittests and small fixes for persistent application cache