예제 #1
0
        public void Set(string key, string value)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException(nameof(key));
            }

            if (string.IsNullOrEmpty(value) == false)
            {
                string normalizedKey = key.ToLower().ToConsulKey();

                var result = _client.CreateKeyValueAsync(normalizedKey, value).GetAwaiter().GetResult();

                if (result == false)
                {
                    throw new KeyNotFoundException("Unable to store key/value: " + normalizedKey + "  " + value);
                }
            }
        }