C# Класс Lucene.Net.Store.RAMDirectory

A memory-resident Directory implementation. Locking implementation is by default the SingleInstanceLockFactory but can be changed with #setLockFactory.

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 {@code byte[1024]} arrays. this class is optimized for small memory-resident indexes. It also has bad concurrency on multithreaded environments.

It is recommended to materialize large indexes on disk and use MMapDirectory, which is a high-performance directory implementation working directly on the file system cache of the operating system, so copying data to Java heap space is not useful.

Наследование: Lucene.Net.Store.BaseDirectory
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
fileMap RAMFile>.HashMap
internalSizeInBytes long

Открытые методы

Метод Описание
CreateOutput ( System name ) : Lucene.Net.Store.IndexOutput

Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

DeleteFile ( System name ) : void

Removes an existing file in the directory.

FileExists ( System name ) : bool

Returns true iff the named file exists in this directory.

FileLength ( System name ) : long

Returns the length in bytes of a file in the directory.

FileModified ( System name ) : long

Returns the time the named file was last modified.

ListAll ( ) : System.String[]
OpenInput ( System name ) : IndexInput

Returns a stream reading an existing file.

RAMDirectory ( ) : System

Constructs an empty Directory.

RAMDirectory ( Directory dir ) : System

Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory.

This should be used only with indices that can fit into memory.

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.

SizeInBytes ( ) : long

Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.

TouchFile ( System name ) : void

Set the modified time of an existing file to now.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Closes the store to future operations, releasing associated memory.

Приватные методы

Метод Описание
OnDeserialized ( System context ) : void
RAMDirectory ( Directory dir, bool closeDir ) : System

Описание методов

CreateOutput() публичный Метод

Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
public CreateOutput ( System name ) : Lucene.Net.Store.IndexOutput
name System
Результат Lucene.Net.Store.IndexOutput

DeleteFile() публичный Метод

Removes an existing file in the directory.
public DeleteFile ( System name ) : void
name System
Результат void

Dispose() защищенный Метод

Closes the store to future operations, releasing associated memory.
protected Dispose ( bool disposing ) : void
disposing bool
Результат void

FileExists() публичный Метод

Returns true iff the named file exists in this directory.
public FileExists ( System name ) : bool
name System
Результат bool

FileLength() публичный Метод

Returns the length in bytes of a file in the directory.
public FileLength ( System name ) : long
name System
Результат long

FileModified() публичный Метод

Returns the time the named file was last modified.
public FileModified ( System name ) : long
name System
Результат long

ListAll() публичный Метод

public ListAll ( ) : System.String[]
Результат System.String[]

OpenInput() публичный Метод

Returns a stream reading an existing file.
public OpenInput ( System name ) : IndexInput
name System
Результат IndexInput

RAMDirectory() публичный Метод

Constructs an empty Directory.
public RAMDirectory ( ) : System
Результат System

RAMDirectory() публичный Метод

Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory.

This should be used only with indices that can fit into memory.

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.

if an error occurs ///
public RAMDirectory ( Directory dir ) : System
dir Directory a Directory value ///
Результат System

SizeInBytes() публичный Метод

Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.
public SizeInBytes ( ) : long
Результат long

TouchFile() публичный Метод

Set the modified time of an existing file to now.
public TouchFile ( System name ) : void
name System
Результат void

Описание свойств

fileMap защищенное свойство

protected HashMap fileMap
Результат RAMFile>.HashMap

internalSizeInBytes защищенное свойство

protected long internalSizeInBytes
Результат long