src/lsi/utils/hosts.py
def _is_valid_cache():
    """
    Returns if the cache is valid (exists and modified within the interval).
    :return: Whether the cache is valid.
    :rtype: ``bool``
    """
    if not os.path.exists(get_cache_location()):
        return False
    modified = os.path.getmtime(get_cache_location())
    modified = time.ctime(modified)
    modified = datetime.strptime(modified, '%a %b %d %H:%M:%S %Y')
    return datetime.now() - modified <= CACHE_EXPIRATION_INTERVAL
def _is_valid_cache():
    """
    Returns if the cache is valid (exists and modified within the interval).
    :return: Whether the cache is valid.
    :rtype: ``bool``
    """
    if not os.path.exists(get_cache_location()):
        return False
    modified = os.path.getmtime(get_cache_location())
    modified = time.ctime(modified)
    modified = datetime.strptime(modified, '%a %b %d %H:%M:%S %Y')
    return datetime.now() - modified <= CACHE_EXPIRATION_INTERVAL
Returns if the cache is valid (exists and modified within the interval).
    :return: Whether the cache is valid.
    :rtype: ``bool``