Esempio n. 1
0
            public virtual void AddEntityToIndex(EntityKey entityKey, Document doc)
            {
                try
                {
                    // putting the entity to cache, but never overwriting local changes
                    this._parent._redis.SetWithRetries(entityKey.ToRedisKey(), new CacheDocumentWrapper(doc), When.NotExists);
                }
                catch (RedisCacheException)
                {
                    // this means the item exists in cache
                }
                catch (Exception ex)
                {
                    this._parent.Log("Error while creating index ({0}): an entity with key {1} failed to be put to cache with exception: {2}", this._searchConditions.Key, entityKey, ex);
                }

                this.RedisTransaction.HashSet(this.IndexKeyInCache, entityKey.ToRedisValue(), string.Empty);
            }