public QueueWorker(IConfiguration config, IVoteData data, ILogger <QueueWorker> logger, IRedisStore redisStore) { _config = config; _data = data; _logger = logger; _redisStore = redisStore; }
/// <summary> /// 获取随机DB /// </summary> /// <param name="key"></param> /// <returns></returns> public static int GetRandomNumber(this IRedisStore redisStore, string key) { var md5 = Md5(key); var n = md5[0]; var numString = "0123456789abcdef"; return(numString.IndexOf(n)); }
public AppRedisCacheStore( IMemoryStore memoryStore, IRedisStore redisStore, IMutilCacheStore mutilCacheStore) { _memoryStore = memoryStore; _redisStore = redisStore; _mutilCacheStore = mutilCacheStore; }
/// <summary> /// RedisValue[]转List对象 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="values"></param> /// <returns></returns> public static List <T> RedisValuesToList <T>(this IRedisStore redisStore, RedisValue[] values) { List <T> result = new List <T>(); foreach (var item in values) { var model = redisStore.RedisValueToObject <T>(item); result.Add(model); } return(result); }
public void Dispose() { redisHash = null; redisKey = null; redisList = null; redisLock = null; redisSet = null; redisSortedSet = null; redisStore = null; redisString = null; redisSubscribe = null; }
/// <summary> /// RedisValueToObject /// </summary> /// <typeparam name="T"></typeparam> /// <param name="value"></param> /// <returns></returns> public static T RedisValueToObject <T>(this IRedisStore redisStore, RedisValue value) { if (typeof(T).Name.Equals(typeof(string).Name)) { return(JsonConvert.DeserializeObject <T>($"'{value}'")); } else { T t = JsonConvert.DeserializeObject <T>(value); if (t == null) { Console.WriteLine($"reids.ConvertObj.t:{null}"); } return(t); } }
public TaskController(ILogger <SiteController> logger, IRedisStore redisStore, ISystemDictionaryRepository systemDictionaryRepository, ITaskInfoRepository taskInfoRepository, ITaskDetailsRepository taskDetailsRepository, IMemberIncomeRepository memberIncomeRepository, ITaskNoviceLogRepository taskNoviceLogRepository, ITaskInfoApp taskInfoApp) { this._ILogger = logger; this._IRedisStore = redisStore; this._ISystemDictionaryRepository = systemDictionaryRepository; this._ITaskInfoApp = taskInfoApp; this._ITaskInfoRepository = taskInfoRepository; this._ITaskDetailsRepository = taskDetailsRepository; this._ITaskNoviceLogRepository = taskNoviceLogRepository; this._IMemberIncomeRepository = memberIncomeRepository; }
public MutilCacheStore(IMemoryStore memoryStore, IRedisStore redisStore) { _memoryStore = memoryStore; _redisStore = redisStore; _subscribeObject = _redisStore.Client.Subscribe((TOPIC_NAME, (msg) => { if (msg == null || string.IsNullOrEmpty(msg.Body)) { return; } var message = msg.Body.ToObject <CacheMessage>(); if (message == null) { return; } OnMessage(message); } )); }
/// <summary> /// 对象转字符串 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="value"></param> /// <returns></returns> public static string ObjectToString <T>(this IRedisStore redisStore, T value) { string result = value is string?value.ToString() : JsonConvert.SerializeObject(value); return(result); }
public static T Do <T>(this IRedisStore redisStore, Func <IDatabaseAsync, T> func, int index = 0) { var database = redisStore.Instance.GetDatabase(index); return(func(database)); }
public WebCategoryRedis(IRedisStore redisStore) { this._IRedisStore = redisStore; }
public WebNewsRedis(IRedisStore redisStore) { this._IRedisStore = redisStore; }
public RedisRepository(IRedisStore redisStore) { this._IRedisStore = redisStore; }
/// <summary> /// ctor /// </summary> /// <param name="cache"></param> /// <param name="httpContextAccessor"></param> /// <param name="configuration"></param> public JwtRedis(IRedisStore redisStore, IHttpContextAccessor httpContextAccessor, IConfiguration configuration) { _IRedisStore = redisStore; _httpContextAccessor = httpContextAccessor; _configuration = configuration; }
public RedisPublisher(IRedisStore redisStore) { _redisStore = redisStore; }
public RedisClientFactory(IRedisStore redisStore, ILoggerFactory loggerFactory) { _redisStore = redisStore; _loggerFactory = loggerFactory; }
public RedisLokiLockHandler(EndPoint[] redisEndPoints) { _redisStore = RedisStore.Instance.Initialize(redisEndPoints); _token = Environment.MachineName; }
public WebSiteRedis(IRedisStore redisStore) : base(redisStore) { this._IRedisStore = redisStore; }
public RedisSubscriber(IRedisStore redisStore) { _redisStore = redisStore; LogPrefix = this.GetType().Name; }
public RedisScheduler(IRedisStore redisStore) { _redisStore = redisStore; }
public RedisGeneralCache(IRedisStore redisStore) { _redisStore = redisStore ?? throw new ArgumentNullException(nameof(redisStore)); }
/// <summary> /// stringList对象转RedisKey[],多个Keys操作 /// </summary> /// <param name="redisKeys"></param> /// <returns></returns> public static RedisKey[] StringsToRedisKeys(this IRedisStore redisStore, List <string> redisKeys) { return(redisKeys.Select(redisKey => (RedisKey)redisKey).ToArray()); }
public WebChannelRedis(IRedisStore redisStore) : base(redisStore) { this._IRedisStore = redisStore; }
public RedisLokiLockHandler(EndPoint[] redisEndPoints) { _redisStore = RedisStore.Instance.Initialize(redisEndPoints); }