IProducerConsumer增加Count和IsEmpty
大石头 authored at 2020-01-10 19:05:31
710.00 B
X
using System;
using System.Collections.Generic;

namespace NewLife.Caching
{
    /// <summary>生产者消费者接口</summary>
    /// <typeparam name="T"></typeparam>
    public interface IProducerConsumer<T>
    {
        /// <summary>元素个数</summary>
        Int32 Count { get; }

        /// <summary>集合是否为空</summary>
        Boolean IsEmpty { get; }

        /// <summary>生产添加</summary>
        /// <param name="values"></param>
        /// <returns></returns>
        Int32 Add(IEnumerable<T> values);

        /// <summary>消费获取</summary>
        /// <param name="count"></param>
        /// <returns></returns>
        IEnumerable<T> Take(Int32 count = 1);
    }
}