Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        /// <summary>
        /// 从Redis库中删除
        /// </summary>
        /// <param name="redisSignal"></param>
        public static void Remove(this RedisSignal redisSignal)
        {
            var key = redisSignal.GetKey();

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

            PersistentStore.Store(key, redisSignal.Value, expireMinutes);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }