Interface IObjectPool<T>
Inherited Members
System.IDisposable.Dispose()
Namespace: FreeSql.Internal.ObjectPool
Assembly: FreeSql.dll
Syntax
public interface IObjectPool<T> : IDisposable
Type Parameters
| Name | Description |
|---|---|
| T |
Properties
| Improve this Doc View SourceIsAvailable
是否可用
Declaration
bool IsAvailable { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Policy
Declaration
IPolicy<T> Policy { get; }
Property Value
| Type | Description |
|---|---|
| IPolicy<T> |
Statistics
统计对象池中的对象
Declaration
string Statistics { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
StatisticsFullily
统计对象池中的对象(完整)
Declaration
string StatisticsFullily { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
UnavailableException
不可用错误
Declaration
Exception UnavailableException { get; }
Property Value
| Type | Description |
|---|---|
| System.Exception |
UnavailableTime
不可用时间
Declaration
DateTime? UnavailableTime { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.DateTime> |
Methods
| Improve this Doc View SourceGet(Nullable<TimeSpan>)
获取资源
Declaration
Object<T> Get(TimeSpan? timeout = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.TimeSpan> | timeout | 超时 |
Returns
| Type | Description |
|---|---|
| Object<T> |
GetAsync()
获取资源
Declaration
Task<Object<T>> GetAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Object<T>> |
Return(Object<T>, Boolean)
使用完毕后,归还资源
Declaration
void Return(Object<T> obj, bool isReset = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Object<T> | obj | 对象 |
| System.Boolean | isReset | 是否重新创建 |
SetUnavailable(Exception, DateTime)
将对象池设置为不可用,后续 Get/GetAsync 均会报错,同时启动后台定时检查服务恢复可用
Declaration
bool SetUnavailable(Exception exception, DateTime lastGetTime)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Exception | exception | |
| System.DateTime | lastGetTime |
Returns
| Type | Description |
|---|---|
| System.Boolean | 由【可用】变成【不可用】时返回true,否则返回false |