Esempio n. 1
0
            public RedisIndex(RedisTableCache parent, string indexKey, SearchConditions searchConditions)
            {
                this._parent           = parent;
                this.IndexKeyInCache   = indexKey;
                this._searchConditions = searchConditions;

                try
                {
                    // (re)registering it in the list of indexes (it should be visible for update operations)
                    this._parent._redis.SetHashWithRetries(this._parent.GetIndexListKeyInCache(), this.IndexKeyInCache, this._searchConditions.ToRedisValue());

                    // asynchronously checking the total number of indexes
                    Task.Run(() => this.TryKeepIndexListSlim(indexKey));

                    // creating an index and marking it as being rebuilt
                    this._parent._redis.CreateNewHashWithRetries(this.IndexKeyInCache, IndexVersionField.Name, IndexVersionField.IsBeingRebuiltValue);

                    this.RedisTransaction = this._parent._redis.BeginTransaction(IndexVersionField.IsBeingRebuiltCondition(this.IndexKeyInCache));
                    this._parent.Log("Index ({0}) was marked as being rebuilt", this._searchConditions.Key);
                }
                catch (Exception ex)
                {
                    this._parent.Log("Failed to start creating index: {0}", ex);

                    // if something goes wrong - dropping the index (but only from the list - we don't want to let parallel update transaction to fail)
                    this._parent._redis.RemoveHashFieldsWithRetries(this._parent.GetIndexListKeyInCache(), this.IndexKeyInCache);
                    throw;
                }
            }
Esempio n. 2
0
 internal TableLock(RedisTableCache parent, string lockKey, TimeSpan lockTimeout)
 {
     this._parent  = parent;
     this._lockKey = lockKey;
     this.LockTable(lockTimeout);
 }
 public RedisProjectionIndex(RedisTableCache parent, string indexKey, SearchConditions searchConditions) : base(parent, indexKey, searchConditions)
 {
 }