class LevelDB (View source)

Methods

__construct(string $name, array $options = [ 'create_if_missing' => true, // if the specified database does not exist will create a new one 'error_if_exists' => false, // if the opened database exists will throw exception 'paranoid_checks' => false, 'block_cache_size' => 8 * (2 << 20), 'write_buffer_size' => 4 << 20, 'block_size' => 4096, 'max_open_files' => 1000, 'block_restart_interval' => 16, 'compression' => LEVELDB_SNAPPY_COMPRESSION, 'comparator' => null, ], array $read_options = [ 'verify_check_sum' => false, //may be set to true to force checksum verification of all data that is read from the file system on behalf of a particular read. By default, no such verification is done. 'fill_cache' => true, ], array $write_options = [ //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. 'sync' => false, ])

No description

string|false
get(string $key, array $read_options = [])

No description

set(string $key, string $value, array $write_options = [])

Alias of LevelDB::put()

put(string $key, string $value, array $write_options = [])

No description

bool
delete(string $key, array $write_options = [])

No description

write(LevelDBWriteBatch $batch, array $write_options = [])

Executes all of the operations added in the write batch.

mixed
getProperty(string $name)

Valid properties:

  • leveldb.stats: returns the status of the entire db
  • leveldb.num-files-at-level: returns the number of files for each level. For example, you can use leveldb.num-files-at-level0 the number of files for zero level.

getApproximateSizes($start, $limit)

No description

compactRange($start, $limit)

No description

close()

No description

getIterator(array $options = [])

No description

getSnapshot()

No description

static 
destroy($name, array $options = [])

No description

static 
repair($name, array $options = [])

No description

Details

__construct(string $name, array $options = [ 'create_if_missing' => true, // if the specified database does not exist will create a new one 'error_if_exists' => false, // if the opened database exists will throw exception 'paranoid_checks' => false, 'block_cache_size' => 8 * (2 << 20), 'write_buffer_size' => 4 << 20, 'block_size' => 4096, 'max_open_files' => 1000, 'block_restart_interval' => 16, 'compression' => LEVELDB_SNAPPY_COMPRESSION, 'comparator' => null, ], array $read_options = [ 'verify_check_sum' => false, //may be set to true to force checksum verification of all data that is read from the file system on behalf of a particular read. By default, no such verification is done. 'fill_cache' => true, ], array $write_options = [ //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. 'sync' => false, ])

No description

Parameters

string $name

Path to database

array $options
array $read_options
array $write_options

string|false get(string $key, array $read_options = [])

No description

Parameters

string $key
array $read_options

Return Value

string|false

set(string $key, string $value, array $write_options = [])

Alias of LevelDB::put()

Parameters

string $key
string $value
array $write_options

put(string $key, string $value, array $write_options = [])

No description

Parameters

string $key
string $value
array $write_options

bool delete(string $key, array $write_options = [])

No description

Parameters

string $key
array $write_options

Return Value

bool

write(LevelDBWriteBatch $batch, array $write_options = [])

Executes all of the operations added in the write batch.

Parameters

LevelDBWriteBatch $batch
array $write_options

mixed getProperty(string $name)

Valid properties:

  • leveldb.stats: returns the status of the entire db
  • leveldb.num-files-at-level: returns the number of files for each level. For example, you can use leveldb.num-files-at-level0 the number of files for zero level.

  • leveldb.sstables: returns current status of sstables

Parameters

string $name

Return Value

mixed

getApproximateSizes($start, $limit)

No description

Parameters

$start
$limit

compactRange($start, $limit)

No description

Parameters

$start
$limit

close()

No description

LevelDBIterator getIterator(array $options = [])

No description

Parameters

array $options

Return Value

LevelDBIterator

LevelDBSnapshot getSnapshot()

No description

Return Value

LevelDBSnapshot

static destroy($name, array $options = [])

No description

Parameters

$name
array $options

static repair($name, array $options = [])

No description

Parameters

$name
array $options