/// <summary> /// Initializes a new instance of the <see cref="BufferWithFifoEviction{T}"/> class. /// </summary> /// <param name="capacity">The buffer capacity.</param> /// <param name="costAssigner">The buffer cost assigner, <see cref="ICostAssigner{T}"/>.</param> /// <param name="log">The log service, <see cref="ILog"/>.</param> public BufferWithFifoEviction(long capacity, ICostAssigner <T> costAssigner, ILog log) : base(capacity) { if (costAssigner == null) { throw new ArgumentException("CostAssigner cannot be null"); } this.log = log ?? new DummyLog(); this.queue = new CostBoundedConcurrentQueue <T>(capacity, costAssigner); this.costAssigner = costAssigner; }
/// <summary> /// Initializes a new instance of the <see cref="CostBoundedConcurrentQueue{T}"/> class. /// </summary> /// <param name="capacity">Capacity the queue.</param> /// <param name="costAssigner">The cost Assigner <see cref="ICostAssigner{T}"/>. </param> public CostBoundedConcurrentQueue(long capacity, ICostAssigner <T> costAssigner) { this.queue = new ConcurrentQueue <T>(); this.costAssigner = costAssigner; this.capacity = capacity; }
/// <summary> /// Initializes a new instance of the <see cref="BufferWithFifoEviction{T}"/> class. /// </summary> /// <param name="capacity">The buffer Capacity.</param> /// <param name="cost">The buffer cost Assigner <see cref="ICostAssigner{T}"/>.</param> public BufferWithFifoEviction(long capacity, ICostAssigner <T> cost) : this(capacity, cost, null) { }