Search Results for

    Show / Hide Table of Contents

    Class ObjectPool<T>

    对象池管理类

    Inheritance
    System.Object
    ObjectPool<T>
    Implements
    IObjectPool<T>
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: FreeSql.Internal.ObjectPool
    Assembly: FreeSql.dll
    Syntax
    public class ObjectPool<T> : IObjectPool<T>, IDisposable
    Type Parameters
    Name Description
    T

    对象类型

    Constructors

    | Improve this Doc View Source

    ObjectPool(IPolicy<T>)

    创建对象池

    Declaration
    public ObjectPool(IPolicy<T> policy)
    Parameters
    Type Name Description
    IPolicy<T> policy

    策略

    | Improve this Doc View Source

    ObjectPool(Int32, Func<T>, Action<Object<T>>)

    创建对象池

    Declaration
    public ObjectPool(int poolsize, Func<T> createObject, Action<Object<T>> onGetObject = null)
    Parameters
    Type Name Description
    System.Int32 poolsize

    池大小

    System.Func<T> createObject

    池内对象的创建委托

    System.Action<Object<T>> onGetObject

    获取池内对象成功后,进行使用前操作

    Properties

    | Improve this Doc View Source

    AvailableTime

    Declaration
    public DateTime? AvailableTime { get; }
    Property Value
    Type Description
    System.Nullable<System.DateTime>
    | Improve this Doc View Source

    IsAvailable

    Declaration
    public bool IsAvailable { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Policy

    Declaration
    public IPolicy<T> Policy { get; protected set; }
    Property Value
    Type Description
    IPolicy<T>
    | Improve this Doc View Source

    Statistics

    Declaration
    public string Statistics { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    StatisticsFullily

    Declaration
    public string StatisticsFullily { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    UnavailableException

    Declaration
    public Exception UnavailableException { get; }
    Property Value
    Type Description
    System.Exception
    | Improve this Doc View Source

    UnavailableTime

    Declaration
    public DateTime? UnavailableTime { get; }
    Property Value
    Type Description
    System.Nullable<System.DateTime>

    Methods

    | Improve this Doc View Source

    AutoFree()

    Declaration
    public void AutoFree()
    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Get(Nullable<TimeSpan>)

    Declaration
    public Object<T> Get(TimeSpan? timeout = null)
    Parameters
    Type Name Description
    System.Nullable<System.TimeSpan> timeout
    Returns
    Type Description
    Object<T>
    | Improve this Doc View Source

    GetAsync()

    Declaration
    public async Task<Object<T>> GetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<Object<T>>
    | Improve this Doc View Source

    LiveCheckAvailable()

    Declaration
    protected bool LiveCheckAvailable()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Return(Object<T>, Boolean)

    Declaration
    public void Return(Object<T> obj, bool isReset = false)
    Parameters
    Type Name Description
    Object<T> obj
    System.Boolean isReset
    | Improve this Doc View Source

    SetUnavailable(Exception, DateTime)

    Declaration
    public bool SetUnavailable(Exception exception, DateTime lastGetTime)
    Parameters
    Type Name Description
    System.Exception exception
    System.DateTime lastGetTime
    Returns
    Type Description
    System.Boolean

    Implements

    IObjectPool<T>
    System.IDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX