/// <summary>
 /// Adds a put operation to the batch.
 /// </summary>
 /// <param name="persister">The collection persister.</param>
 /// <param name="data">The data to put in the cache.</param>
 internal void AddToBatch(ICollectionPersister persister, CachePutData data)
 {
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Adding a put operation to batch for collection role {0} and key {1}", persister.Role, data.Key);
     }
     AddToBatch(persister.Cache, data);
 }
 /// <summary>
 /// Adds a put operation to the batch.
 /// </summary>
 /// <param name="persister">The entity persister.</param>
 /// <param name="data">The data to put in the cache.</param>
 internal void AddToBatch(IEntityPersister persister, CachePutData data)
 {
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Adding a put operation to batch for entity {0} and key {1}", persister.EntityName, data.Key);
     }
     AddToBatch(persister.Cache, data);
 }
        private void AddToBatch(ICacheConcurrencyStrategy cache, CachePutData data)
        {
            if (!_putBatches.TryGetValue(cache, out var cachePutBatch))
            {
                cachePutBatch = new CachePutBatch(_session, cache);
                _putBatches.Add(cache, cachePutBatch);
            }

            cachePutBatch.Add(data);
        }
Esempio n. 4
0
 /// <summary>
 /// Adds a put operation to the batch. If the batch size reached the persister batch
 /// size, the batch will be executed.
 /// </summary>
 /// <param name="persister">The collection persister.</param>
 /// <param name="data">The data to put in the cache.</param>
 public void AddToBatch(ICollectionPersister persister, CachePutData data)
 {
     if (ShouldExecuteBatch(persister, _putBatch))
     {
         ExecuteBatch();
         _currentPersister = persister;
         _currentBatch     = _putBatch = new CachePutBatch(_session, persister.Cache);
     }
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Adding a put operation to batch for collection role {0} and key {1}", persister.Role, data.Key);
     }
     _putBatch.Add(data);
 }
Esempio n. 5
0
 /// <summary>
 /// Adds a put operation to the batch. If the batch size reached the persister batch
 /// size, the batch will be executed.
 /// </summary>
 /// <param name="persister">The collection persister.</param>
 /// <param name="data">The data to put in the cache.</param>
 /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
 public async Task AddToBatchAsync(ICollectionPersister persister, CachePutData data, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     if (ShouldExecuteBatch(persister, _putBatch))
     {
         await(ExecuteBatchAsync(cancellationToken)).ConfigureAwait(false);
         _currentPersister = persister;
         _currentBatch     = _putBatch = new CachePutBatch(_session, persister.Cache);
     }
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Adding a put operation to batch for collection role {0} and key {1}", persister.Role, data.Key);
     }
     _putBatch.Add(data);
 }