BufferManager 类

定义

许多 Windows Communication Foundation (WCF) 功能都需要使用缓冲区,然而创建和销毁缓冲区的造价非常高。Many Windows Communication Foundation (WCF) features require the use of buffers, which are expensive to create and destroy. 您可以使用 BufferManager 类来管理缓冲池。You can use the BufferManager class to manage a buffer pool. 缓冲池及其缓冲区是在实例化此类时创建,在垃圾回收将缓冲池回收时销毁。The pool and its buffers are created when you instantiate this class and destroyed when the buffer pool is reclaimed by garbage collection. 每次需要使用缓冲区时,您就可以从缓冲池中取出一个缓冲区来进行使用,然后在使用完毕后将其返回到缓冲池。Every time you need to use a buffer, you take one from the pool, use it, and return it to the pool when done. 这个过程要比每次需要使用缓冲区时就创建一个然后再销毁快得多。This process is much faster than creating and destroying a buffer every time you need to use one.

public ref class BufferManager abstract
public abstract class BufferManager
type BufferManager = class
Public MustInherit Class BufferManager
继承
BufferManager

注解

此类通常用于实现自定义编码器或自定义传输通道。This class is commonly used while implementing custom encoders or custom transport channels.

构造函数

BufferManager()

初始化 BufferManager 类的新实例。Initializes a new instance of the BufferManager class.

方法

Clear()

释放目前在管理器中缓存的缓冲区。Releases the buffers currently cached in the manager.

CreateBufferManager(Int64, Int32)

使用指定的最大缓冲池大小和缓冲池中每个单独缓冲区的最大大小创建新的 BufferManager。Creates a new BufferManager with a specified maximum buffer pool size and a maximum size for each individual buffer in the pool.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ReturnBuffer(Byte[])

将缓冲区返回到缓冲池。Returns a buffer to the pool.

TakeBuffer(Int32)

从缓冲池获取一个至少为指定大小的缓冲区。Gets a buffer of at least the specified size from the pool.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于