remove duration parameter from CacheEngine::write

it isn't supposed to be a public property. Also move key manipulation
from Cache to CacheEngine instances
_key only returns a valid value

or throws an exception, so no need to check the return value
update mock to account for prefix usage