C# Class Microsoft.Isam.Esent.Interop.MemoryCache

Cache allocated chunks of memory that are needed for very short periods of time. The memory is not zeroed on allocation.
Afficher le fichier Open project: ayende/managed-esent Class Usage Examples

Méthodes publiques

Méthode Description
Allocate ( ) : byte[]

Allocates a chunk of memory. If memory is cached it is returned. If no memory is cached then it is allocated. Check the size of the returned buffer to determine how much memory was allocated.

Free ( byte data ) : void

Frees an unused buffer. This may be added to the cache.

MemoryCache ( int bufferSize, int maxCachedBuffers ) : System

Initializes a new instance of the MemoryCache class.

Private Methods

Méthode Description
GetStartingOffset ( ) : int

Get the offset in the cached buffers array to start allocating or freeing buffers to. This is done so that all threads don't start operating on slot zero, which would increase contention.

Method Details

Allocate() public méthode

Allocates a chunk of memory. If memory is cached it is returned. If no memory is cached then it is allocated. Check the size of the returned buffer to determine how much memory was allocated.
public Allocate ( ) : byte[]
Résultat byte[]

Free() public méthode

Frees an unused buffer. This may be added to the cache.
public Free ( byte data ) : void
data byte The memory to free.
Résultat void

MemoryCache() public méthode

Initializes a new instance of the MemoryCache class.
public MemoryCache ( int bufferSize, int maxCachedBuffers ) : System
bufferSize int /// The size of the buffers to cache. ///
maxCachedBuffers int /// The maximum number of buffers to cache. ///
Résultat System