예제 #1
0
        /// <summary>
        /// Cleans up the current batch.
        /// </summary>
        public void Cleanup()
        {
            _putBatch = null;

            _currentBatch     = null;
            _currentPersister = null;
        }
예제 #2
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);
 }
예제 #3
0
 private bool ShouldExecuteBatch(ICollectionPersister persister, AbstractCacheBatch batch)
 {
     return(batch != _currentBatch || _currentPersister != persister ||
            _currentBatch.BatchSize >= persister.GetBatchSize());
 }