[1.5] Overwriting old cached assets

With ClearDependencyCacheAsync(), I can remove a cached asset, much like Caching.Clear() but for a specific key. The problem is that, whenever that specific key detected an update from the server using GetDownloadSizeAsync(), when I now use ClearDependencyCacheAsync(), it is not removing the cached asset.

This is more or less the code:

void Start()
{
    Addressables.GetDownloadSizeAsync(key).Completed += SizeDone;
}

void SizeDone(AsyncOperationHandle<long> obj)
{
    long fileSize = obj.Result;
        if (fileSize == 0)
        {
            //Asset is cached
            //
            //
        }
        else
        {
            //Since it is a new asset, it will come here
            Addressables.LoadSceneAsync(key, LoadSceneMode.Single, false).Completed += SceneDone;
        }

        Addressables.Release(obj);
}

After these, the asset/scene is now cached. Now, when I do this:

void Start()
{
    Addressables.ClearDependencyCacheAsync(key);
}

As expected, the cached asset is removed, as proven by the reduction of the file size. But if you cached again the asset, then do an update to the asset and run this code:

void Start()
{
    Addressables.GetDownloadSizeAsync(key).Completed += SizeDone;
}

void SizeDone(AsyncOperationHandle<long> obj)
{
    long fileSize = obj.Result;
        if (fileSize == 0)
        {
            //Asset is cached
            //
            //
        }
        else
        {
            //It will enter here, as there is an update, so we need to clear first the old asset and download the new one
            Addressables.ClearDependencyCacheAsync(key);
            Addressables.LoadSceneAsync(key, LoadSceneMode.Single, false).Completed += SceneDone;
        }

        Addressables.Release(obj);
}

The old asset was not cleared, and the new asset just added to the file size. I was expecting that the old asset will be removed first, then download the new one. I also tried using the handle as the argument, but it has the same result.

Is this the right way? or are there other syntax that is used for cleaning old assets. Since there is no outright way of overwriting an old asset, I tried doing this. Unfortunately, it didn’t work

ClearDependencyCacheAsync API doesn’t even make sense. It doesn’t return anything that can be awaited, and doesn’t accept any callbacks as arguments.