BuildXL.Cache.ContentStore.Distributed.NuCache.RedisGlobalStore.SetLocationBitAndExpireAsync C# (CSharp) Метод

SetLocationBitAndExpireAsync() приватный Метод

private SetLocationBitAndExpireAsync ( OperationContext context, IBatch batch, RedisKey key, BuildXL.Cache.ContentStore.Distributed.NuCache.ShortHashWithSize hash, BuildXL.Cache.ContentStore.Distributed.NuCache.MachineId machineId ) : Task
context OperationContext
batch IBatch
key RedisKey
hash BuildXL.Cache.ContentStore.Distributed.NuCache.ShortHashWithSize
machineId BuildXL.Cache.ContentStore.Distributed.NuCache.MachineId
Результат Task
        private async Task<Unit> SetLocationBitAndExpireAsync(OperationContext context, IBatch batch, RedisKey key, ShortHashWithSize hash, MachineId machineId)
        {
            var tasks = new List<Task>();

            // NOTE: The order here matters. KeyExpire must be after creation of the entry. SetBit creates the entry if needed.
            tasks.Add(batch.StringSetBitAsync(key, machineId.GetContentLocationEntryBitOffset(), true));
            tasks.Add(batch.KeyExpireAsync(key, Configuration.LocationEntryExpiry));

            // NOTE: We don't set the size when using optimistic location registration because the entry should have already been created at this point (the prior set
            // if not exists call failed indicating the entry already exists).
            // There is a small race condition if the entry was near-expiry and this call ends up recreating the entry without the size being set. We accept
            // this possibility since we have to handle unknown size and either case and the occurrence of the race should be rare. Also, we can mitigate by
            // applying the size from the local database which should be known if the entry is that old.
            if (!Configuration.UseOptimisticRegisterLocalLocation && hash.Size >= 0)
            {
                tasks.Add(batch.StringSetRangeAsync(key, 0, ContentLocationEntry.ConvertSizeToRedisRangeBytes(hash.Size)));
            }

            await Task.WhenAll(tasks);
            return Unit.Void;
        }