public ISignal CreateSignal(string key, object value, int expireMinutes)
        {
            var signal = new RedisSignal()
            {
                TenantType = _tentantType,
                TenantId   = _tentantId,
                UId        = key,
                Value      = value
            };

            signal.Store(expireMinutes);
            return(signal);
        }
        /// <summary>
        /// 根据关键字委托创建一个信号量
        /// </summary>
        /// <param name="funcKey">关键字委托</param>
        /// <param name="value">信号量值</param>
        /// <returns>信号量</returns>
        public ISignal CreateSignal(Func <string> funcKey, object value)
        {
            var signal = new RedisSignal()
            {
                TenantType = _tentantType,
                TenantId   = _tentantId,
                UId        = funcKey(),
                Value      = value
            };

            signal.Store();
            return(signal);
        }
        public ISignal CreateSignal(object value, int expireMinutes)
        {
            var signal = new RedisSignal()
            {
                TenantType = _tentantType,
                TenantId   = _tentantId,
                UId        = RandomKey.GetKey(),
                Value      = value
            };

            signal.Store(expireMinutes);
            return(signal);
        }
        public ISignal FindSignal(string key)
        {
            string rkey  = MessageExtension.GetRedisKey(_tentantType, _tentantId, key);
            var    value = MessageExtension.PersistentStore.Get(rkey);

            if (value == null)
            {
                return(null);
            }
            var signal = new RedisSignal()
            {
                TenantType = _tentantType,
                TenantId   = _tentantId,
                UId        = key,
                Value      = value
            };

            return(signal);
        }
Beispiel #5
0
        /// <summary>
        /// 从Redis库中删除
        /// </summary>
        /// <param name="redisSignal"></param>
        public static void Remove(this RedisSignal redisSignal)
        {
            var key = redisSignal.GetKey();

            PersistentStore.Remove(key);
        }
Beispiel #6
0
        public static void Store(this RedisSignal redisSignal, int expireMinutes)
        {
            var key = redisSignal.GetKey();

            PersistentStore.Store(key, redisSignal.Value, expireMinutes);
        }
Beispiel #7
0
        /// <summary>
        /// 存储到Redis库中
        /// </summary>
        /// <param name="redisSignal"></param>
        public static void Store(this RedisSignal redisSignal)
        {
            var key = redisSignal.GetKey();

            PersistentStore.Store(key, redisSignal.Value);
        }
Beispiel #8
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="redisSignal">Redis信号</param>
        /// <returns>Redis一个Key的值</returns>
        public static string GetKey(this RedisSignal redisSignal)
        {
            string rKey = GetRedisKey(redisSignal.TenantType, redisSignal.TenantId, redisSignal.UId);

            return(rKey);
        }