public CacheLockWrapper(IContainerCacheStragegy containerCacheStragegy, string resourceName, string key, int retryCount, TimeSpan retryDelay)
        {
            _containerCacheStragegy = containerCacheStragegy;
            _resourceName = resourceName + key;/*加上Key可以针对某个AppId加锁*/

            if (retryCount != 0 && retryDelay.Ticks != 0)
            {
                LockSuccessful = _containerCacheStragegy.Lock(_resourceName, retryCount, retryDelay);
            }
            else
            {
                LockSuccessful = _containerCacheStragegy.Lock(_resourceName);
            }
        }
        public CacheLockWrapper(IContainerCacheStragegy containerCacheStragegy, string resourceName, string key, int retryCount, TimeSpan retryDelay)
        {
            _containerCacheStragegy = containerCacheStragegy;
            _resourceName           = resourceName + key;/*加上Key可以针对某个AppId加锁*/

            if (retryCount != 0 && retryDelay.Ticks != 0)
            {
                LockSuccessful = _containerCacheStragegy.Lock(_resourceName, retryCount, retryDelay);
            }
            else
            {
                LockSuccessful = _containerCacheStragegy.Lock(_resourceName);
            }
        }
        public CacheLockWrapper(IContainerCacheStragegy containerCacheStragegy, string resourceName, string key)
            : this(containerCacheStragegy, resourceName, key, 0, new TimeSpan())
        {

        }
Beispiel #4
0
 public static CacheLockWrapper InstanceCacheLockWrapper(this IContainerCacheStragegy stragegy, string resourceName, string key)
 {
     return(InstanceCacheLockWrapper(stragegy, resourceName, key, 0, new TimeSpan()));
 }
Beispiel #5
0
 public static CacheLockWrapper InstanceCacheLockWrapper(this IContainerCacheStragegy stragegy, string resourceName, string key, int retryCount, TimeSpan retryDelay)
 {
     return(new CacheLockWrapper(stragegy, resourceName, key, retryCount, retryDelay));
 }
 public CacheLockWrapper(IContainerCacheStragegy containerCacheStragegy, string resourceName, string key)
     : this(containerCacheStragegy, resourceName, key, 0, new TimeSpan())
 {
 }