extract cache handling to work with zend-cache