Example #1
0
 public RedSyncLock(RedisContextProvider context, string key, int expiryTimeout = 30000, int waitTimeout = 10000, int retryTimeout = 100)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     _lock = context.LockFactory.Create(key, TimeSpan.FromMilliseconds(expiryTimeout),
                                        TimeSpan.FromMilliseconds(waitTimeout), TimeSpan.FromMilliseconds(retryTimeout));
 }
Example #2
0
        public RedisCacheRepository(RedisContextProvider context, ICacheNotificationsRouter notificationsRouter, Func <TKey, string> keySerializer,
                                    Func <string, TKey> keyDeserializer, TimeSpan?ttl = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (keySerializer == null)
            {
                throw new ArgumentNullException(nameof(keySerializer));
            }
            if (keyDeserializer == null)
            {
                throw new ArgumentNullException(nameof(keyDeserializer));
            }
            _context             = context;
            _notificationsRouter = notificationsRouter;
            _keySerializer       = keySerializer;
            _keyDeserializer     = keyDeserializer;
            _ttl = ttl;

            SubscribeToKeySpaceEvents();
        }
Example #3
0
 public RedSyncLock(RedisContextProvider context, string key, int expiryTimeout = 30000, int waitTimeout = 10000, int retryTimeout = 100)
 {
     if (context == null) throw new ArgumentNullException(nameof(context));
     _lock = context.LockFactory.Create(key, TimeSpan.FromMilliseconds(expiryTimeout),
         TimeSpan.FromMilliseconds(waitTimeout), TimeSpan.FromMilliseconds(retryTimeout));
 }