Ejemplo n.º 1
0
        /// <summary>
        /// 释放指定资源的锁
        /// </summary>
        /// <param name="lockInfo">锁对象</param>
        public void Unlock(LockInfo lockInfo)
        {
            RedisLock redisLock = new RedisLock(RedisManager.Connection);

            redisLock.Unlock(lockInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 释放指定资源的锁
        /// </summary>
        /// <param name="resourceKey">资源名称</param>
        /// <param name="resourceValue">锁资源对应的值</param>
        public void Unlock(string resourceKey, string resourceValue)
        {
            RedisLock redisLock = new RedisLock(RedisManager.Connection);

            redisLock.Unlock(resourceKey, resourceValue);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取指定资源的锁
        /// </summary>
        /// <param name="resourceKey">锁资源名称</param>
        /// <param name="expires">锁过期时间</param>
        /// <param name="lockInfo">获取到的锁对象</param>
        /// <param name="resourceValue">锁资源对应的值</param>
        /// <returns>是否成功获取锁</returns>
        public bool Lock(string resourceKey, TimeSpan expires, out LockInfo lockInfo, string resourceValue = null)
        {
            RedisLock redisLock = new RedisLock(RedisManager.Connection);

            return(redisLock.Lock(resourceKey, expires, out lockInfo, resourceValue));
        }