/// <summary>
        /// Parses a Redis string to a <see cref="TimeSpan"/> value.
        /// </summary>
        /// <param name="value">The string value to parse.</param>
        /// <returns>The parsed <see cref="TimeSpan"/> value.</returns>
        /// <exception cref="ArgumentNullException">Parameter <paramref name="value"/> is null.</exception>
        /// <exception cref="ArgumentException">Parameter <paramref name="value"/> cannot be parsed to <see cref="TimeSpan"/>.</exception>
        public static TimeSpan ParseTimeSpan(string value)
        {
            long ticks = RedisConverter.ParseLong(value);

            return(TimeSpan.FromTicks(ticks));
        }
        /// <summary>
        /// Parses a Redis string to an object.
        /// </summary>
        /// <param name="value">The string value to parse.</param>
        /// <param name="toType">The type of the object to parse.</param>
        /// <returns>The parsed object.</returns>
        /// <exception cref="ArgumentNullException">Parameter <paramref name="toType"/> is null.</exception>
        /// <exception cref="NotSupportedException">Type <paramref name="toType" /> is not supported.</exception>
        public static object ParseValue(string value, Type toType)
        {
            if (toType == null)
            {
                throw new ArgumentNullException("toType");
            }

            if (toType == typeof(string))
            {
                return(value);
            }

            if (toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable <>))
            {
                if (string.IsNullOrEmpty(value))
                {
                    return(null);
                }

                toType = toType.GetGenericArguments()[0];
            }

            if (toType == typeof(int))
            {
                return(RedisConverter.ParseInteger(value));
            }

            if (toType == typeof(long))
            {
                return(RedisConverter.ParseLong(value));
            }

            if (toType == typeof(float))
            {
                return(RedisConverter.ParseFloat(value));
            }

            if (toType == typeof(double))
            {
                return(RedisConverter.ParseDouble(value));
            }

            if (toType == typeof(Guid))
            {
                return(RedisConverter.ParseGuid(value));
            }

            if (toType == typeof(TimeSpan))
            {
                return(RedisConverter.ParseTimeSpan(value));
            }

            if (toType == typeof(DateTime))
            {
                return(RedisConverter.ParseDateTime(value));
            }

            if (toType == typeof(bool))
            {
                return(RedisConverter.ParseBoolean(value));
            }

            if (toType.IsEnum)
            {
                return(RedisConverter.ParseEnum(value, toType));
            }

            if (toType == typeof(Type))
            {
                return(RedisConverter.ParseType(value));
            }

            if (toType == typeof(Version))
            {
                return(RedisConverter.ParseVersion(value));
            }

            throw new NotSupportedException <Type>(toType);
        }
        /// <summary>
        /// Parses a Redis string to a <see cref="DateTime"/> value.
        /// </summary>
        /// <param name="value">The string value to parse.</param>
        /// <returns>The parsed <see cref="DateTime"/> value.</returns>
        /// <exception cref="ArgumentNullException">Parameter <paramref name="value"/> is null.</exception>
        /// <exception cref="ArgumentException">Parameter <paramref name="value"/> cannot be parsed to <see cref="DateTime"/>.</exception>
        public static DateTime ParseDateTime(string value)
        {
            long ticks = RedisConverter.ParseLong(value);

            return(new DateTime(ticks));
        }