src/Library/NetPro.StackExchange.Redis/StackExchange.Redis.Extensions.Core/Implementations/RedisDatabase.List.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using StackExchange.Redis.Extensions.Core.Abstractions;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace StackExchange.Redis.Extensions.Core.Implementations
{
public partial class RedisDatabase : IRedisDatabase
{
public Task<long> ListAddToLeftAsync<T>(string key, T item, When when = When.Always, CommandFlags flags = CommandFlags.None)
where T : class
{
if (string.IsNullOrEmpty(key))
throw new ArgumentException("key cannot be empty.", nameof(key));
if (item == null)
throw new ArgumentNullException(nameof(item), "item cannot be null.");
var serializedItem = Serializer.Serialize(item);
return Database.ListLeftPushAsync(key, serializedItem, when, flags);
}
public long ListAddToLeft<T>(string key, T item, When when = When.Always, CommandFlags flags = CommandFlags.None)
where T : class
{
if (string.IsNullOrEmpty(key))
throw new ArgumentException("key cannot be empty.", nameof(key));
if (item == null)
throw new ArgumentNullException(nameof(item), "item cannot be null.");
var serializedItem = Serializer.Serialize(item);
return Database.ListLeftPush(key, serializedItem, when, flags);
}
public Task<long> ListAddToLeftAsync<T>(string key, T[] items, CommandFlags flags = CommandFlags.None)
where T : class
{
if (string.IsNullOrEmpty(key))
throw new ArgumentException("key cannot be empty.", nameof(key));
if (items == null)
throw new ArgumentNullException(nameof(items), "item cannot be null.");
var serializedItems = items.Select(x => (RedisValue)Serializer.Serialize(x)).ToArray();
return Database.ListLeftPushAsync(key, serializedItems, flags);
}
public long ListAddToLeft<T>(string key, T[] items, CommandFlags flags = CommandFlags.None)
where T : class
{
if (string.IsNullOrEmpty(key))
throw new ArgumentException("key cannot be empty.", nameof(key));
if (items == null)
throw new ArgumentNullException(nameof(items), "item cannot be null.");
后面还有 38 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。