/// <summary> /// 将值 <paramref name="value"/> 插入到列表 <paramref name="key"/> 当中,位于值 <paramref name="pivot"/> 之前或之后。 /// </summary> /// <param name="client">Redis 客户端。</param> /// <param name="key">列表的键名。</param> /// <param name="position">插入的位置。</param> /// <param name="pivot">定位的支点键名。</param> /// <param name="value">插入的值。</param> /// <returns>插入的结果。</returns> public static long LInsert(this IRedisClient client, string key, RedisInsertPosition position, string pivot, BinaryValue value) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException(nameof(key)); } if (string.IsNullOrWhiteSpace(pivot)) { throw new ArgumentNullException(nameof(pivot)); } return(client.Execute(new RedisInteger("LINSERT", key , position == RedisInsertPosition.Before ? "BEFORE" : "AFTER" , pivot, value))); }
/// <summary> /// 将值 <paramref name="value"/> 插入到列表 <paramref name="key"/> 当中,位于值 <paramref name="pivot"/> 之前或之后。 /// </summary> /// <param name="client">Redis 客户端。</param> /// <param name="key">列表的键名。</param> /// <param name="position">插入的位置。</param> /// <param name="pivot">定位的支点键名。</param> /// <param name="value">插入的值。</param> /// <returns>插入的结果。</returns> public static long LInsert(this IRedisClient client, string key, RedisInsertPosition position, string pivot, BinaryValue value) { if(client == null) throw new ArgumentNullException(nameof(client)); if(string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key)); if(string.IsNullOrWhiteSpace(pivot)) throw new ArgumentNullException(nameof(pivot)); return client.Execute(new RedisInteger("LINSERT", key , position == RedisInsertPosition.Before ? "BEFORE" : "AFTER" , pivot, value)); }