Esempio n. 1
0
        /// <summary>
        ///     Determines if the specified hash field exists in redis.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public bool HashKeyExists(RedisHashKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            return(_database.HashExists(key.Key, key.HashField));
        }
Esempio n. 2
0
        /// <summary>
        ///     Stores the specified value against the specified hash value for the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="flags">The flags.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">key</exception>
        public bool HashSet(RedisHashKey key, RedisValue value, CommandFlags flags = CommandFlags.FireAndForget)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            return(_database.HashSet(key.Key, key.HashField, value, When.Always, flags));
        }
Esempio n. 3
0
        /// <summary>
        ///     Deletes the specified hash field from the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="flags">The flags.</param>
        /// <returns></returns>
        public bool HashDelete(RedisHashKey key, CommandFlags flags = CommandFlags.FireAndForget)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            return(_database.HashDelete(key.Key, key.HashField, flags));
        }
Esempio n. 4
0
        /// <summary>
        ///     Attempts to retrieve the value stored against the specified key and hash field.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">key</exception>
        public bool TryGetHash(RedisHashKey key, out RedisValue value)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            var val = _database.HashGet(key.Key, key.HashField);

            if (val.HasValue)
            {
                value = val;
                return(true);
            }

            value = RedisValue.Null;
            return(false);
        }