C# Class 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.

Inheritance: Lucene.Net.Store.BaseDirectory
Afficher le fichier Open project: synhershko/lucene.net Class Usage Examples

Protected Properties

Свойство Type Description
fileMap RAMFile>.HashMap
internalSizeInBytes long

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Closes the store to future operations, releasing associated memory.

Private Methods

Méthode Description
OnDeserialized ( System context ) : void
RAMDirectory ( Directory dir, bool closeDir ) : System

Method Details

CreateOutput() public méthode

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
Résultat Lucene.Net.Store.IndexOutput

DeleteFile() public méthode

Removes an existing file in the directory.
public DeleteFile ( System name ) : void
name System
Résultat void

Dispose() protected méthode

Closes the store to future operations, releasing associated memory.
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

FileExists() public méthode

Returns true iff the named file exists in this directory.
public FileExists ( System name ) : bool
name System
Résultat bool

FileLength() public méthode

Returns the length in bytes of a file in the directory.
public FileLength ( System name ) : long
name System
Résultat long

FileModified() public méthode

Returns the time the named file was last modified.
public FileModified ( System name ) : long
name System
Résultat long

ListAll() public méthode

public ListAll ( ) : System.String[]
Résultat System.String[]

OpenInput() public méthode

Returns a stream reading an existing file.
public OpenInput ( System name ) : IndexInput
name System
Résultat IndexInput

RAMDirectory() public méthode

Constructs an empty Directory.
public RAMDirectory ( ) : System
Résultat System

RAMDirectory() public méthode

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 ///
Résultat System

SizeInBytes() public méthode

Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.
public SizeInBytes ( ) : long
Résultat long

TouchFile() public méthode

Set the modified time of an existing file to now.
public TouchFile ( System name ) : void
name System
Résultat void

Property Details

fileMap protected_oe property

protected HashMap fileMap
Résultat RAMFile>.HashMap

internalSizeInBytes protected_oe property

protected long internalSizeInBytes
Résultat long