Elight.Utility/Extension/DataCache/RedisCache.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using ServiceStack.Redis;
namespace Elight.Utility.Extension.DataCache
{
public class RedisCache : ICacheService
{
ServiceStackRedis service = null;
public RedisCache(string host, int port, string password, int expirySeconds, long db)
{
service = new ServiceStackRedis(host, port, password, expirySeconds, db);
}
public RedisCache(string host)
{
service = new ServiceStackRedis(host);
}
public RedisCache(string host, int port)
{
service = new ServiceStackRedis(host, port);
}
public RedisCache()
{
service = new ServiceStackRedis();
}
public void Add<V>(string key, V value)
{
service.Set(key, value);
}
public void Add<V>(string key, V value, int cacheDurationInSeconds)
{
service.Set(key, value, cacheDurationInSeconds);
}
public bool ContainsKey<V>(string key)
{
return service.ContainsKey(key);
}
public V Get<V>(string key)
{
return service.Get<V>(key);
}
public IEnumerable<string> GetAllKey<V>()
{
后面还有 133 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。