import json


def get_swiftlm_uptime_mon_data(uptime_stats_file, logger, openr=open):
    """retrieve values from a swiftlm uptime mon cache file

    :params cache_file: cache file to retrieve items from.
    :params openr: open to use [for unittests]
    :return: dict of cache items and their values or none if not found
    """
    try:
        with openr(uptime_stats_file, 'r') as f:
            return json.load(f)
    except IOError:
        logger.exception('Error reading swiftlm uptime mon cache file')
    except ValueError:
        logger.exception('Error parsing swiftlm uptime mon cache file')