def GetCacheValueByObject(self, vfs_object):
    """Retrieves the cache value for the cached object.

    Args:
      vfs_object (object): VFS object that was cached.

    Returns:
      tuple[str, ObjectsCacheValue]: identifier and cache value object or
          (None, None) if not cached.

    Raises:
      RuntimeError: if the cache value is missing.
    """
    for identifier, cache_value in iter(self._values.items()):
      if not cache_value:
        raise RuntimeError('Missing cache value.')

      if cache_value.vfs_object == vfs_object:
        return identifier, cache_value

    return None, None