Microsoft.Alm.Authentication.SecretCache.WriteToken C# (CSharp) Method

WriteToken() public method

Writes a token to the cache.
public WriteToken ( TargetUri targetUri, Token token ) : void
targetUri TargetUri The key which to index the token by.
token Token The token to write to the cache.
return void
        public void WriteToken(TargetUri targetUri, Token token)
        {
            BaseSecureStore.ValidateTargetUri(targetUri);
            Token.Validate(token);

            string targetName = this.GetTargetName(targetUri);

            lock (_cache)
            {
                if (_cache.ContainsKey(targetName))
                {
                    _cache[targetName] = token;
                }
                else
                {
                    _cache.Add(targetName, token);
                }
            }
        }