Constructor RAMDirectory
RAMDirectory()
Constructs an empty Directory.
Declaration
public RAMDirectory()
RAMDirectory(Directory, IOContext)
Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory.
Warning: this class is not intended to work with huge indexes. Everything beyond several hundred megabytes will waste resources (GC cycles), because it uses an internal buffer size of 1024 bytes, producing millions of byte[1024] arrays. this class is optimized for small memory-resident indexes. It also has bad concurrency on multithreaded environments.
For disk-based indexes it is recommended to use MMapDirectory, which is a high-performance directory implementation working directly on the file system cache of the operating system, so copying data to heap space is not useful.
Note that the resulting RAMDirectory instance is fully independent from the original Directory (it is a complete copy). Any subsequent changes to the original Directory will not be visible in the RAMDirectory instance.
Declaration
public RAMDirectory(Directory dir, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
Directory | dir | a Directory value |
IOContext | context | io context |