Class DiskSpacePool
Represents a pool of segments of the limited size on the disk.
Implements
Inherited Members
Namespace: DotNext.Runtime.Caching
Assembly: DotNext.IO.dll
Syntax
public class DiskSpacePool : Disposable, IDisposable
Remarks
This class can be used to organize on-disk cache in combination with RandomAccessCache
.
All members of this class are thread-safe.
Constructors
| Edit this page View SourceDiskSpacePool(int, in Options)
Initializes a new pool of segments on the disk in temporary directory.
Declaration
public DiskSpacePool(int maxSegmentSize, in DiskSpacePool.Options options = default)
Parameters
Type | Name | Description |
---|---|---|
int | maxSegmentSize | The maximum size of the segment to rent, in bytes. |
DiskSpacePool.Options | options | The configuration options. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
DiskSpacePool(string, int, in Options)
Initializes a new pool of segments on the disk.
Declaration
public DiskSpacePool(string path, int maxSegmentSize, in DiskSpacePool.Options options = default)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to the file that is used internally to allocate the disk space. |
int | maxSegmentSize | The maximum size of the segment to rent, in bytes. |
DiskSpacePool.Options | options | The configuration options. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Properties
| Edit this page View SourceMaxSegmentSize
Gets the maximum size of the segment to be rented, in bytes.
Declaration
public int MaxSegmentSize { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceDispose(bool)
Releases managed and unmanaged resources associated with this object.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true if called from Dispose(); false if called from finalizer ~Disposable(). |
Overrides
| Edit this page View SourceRent()
Rents a space on the disk.
Declaration
public DiskSpacePool.Segment Rent()
Returns
Type | Description |
---|---|
DiskSpacePool.Segment | The segment within the file. |