def get_cache_info(rootdir, cache_max_fs_fraction):
    'Get information about the cache itself'
    result = {}
    try:
        stat = os.statvfs(rootdir)
        total_size = int(((stat.f_blocks * stat.f_bsize) * cache_max_fs_fraction))
        free_size = int((total_size - ((stat.f_blocks - stat.f_bfree) * stat.f_bsize)))
        result['total_cache_bytes'] = total_size
        result['free_cache_bytes'] = free_size
        result['free_cache_fraction'] = (1 - (float((stat.f_blocks - stat.f_bfree)) / int((stat.f_blocks * cache_max_fs_fraction))))
        return result
    except (OSError, IOError) as ex:
        return {}
Get information about the cache itself
def get_cache_info(rootdir, cache_max_fs_fraction):
    
    result = {}
    try:
        stat = os.statvfs(rootdir)
        total_size = int(((stat.f_blocks * stat.f_bsize) * cache_max_fs_fraction))
        free_size = int((total_size - ((stat.f_blocks - stat.f_bfree) * stat.f_bsize)))
        result['total_cache_bytes'] = total_size
        result['free_cache_bytes'] = free_size
        result['free_cache_fraction'] = (1 - (float((stat.f_blocks - stat.f_bfree)) / int((stat.f_blocks * cache_max_fs_fraction))))
        return result
    except (OSError, IOError) as ex:
        return {}