Improve this page on GitHub

SSDB PHP Client API Documentation

@author: ideawu
@updated: 2014-11-05

SSDB is a high performance NoSQL database, an alternative for Redis, the official website is http://ssdb.io. This documentation describes the PHP client API of SSDB.

Notice: The phrases "hashmap", "hash", "map" are equivelant in SSDB.

Class SimpleSSDB

Quick Start

<?php
include_once('SSDB.php');
try{
    $ssdb = new SimpleSSDB('127.0.0.1', 8888);
}catch(Exception $e){
    die(__LINE__ . ' ' . $e->getMessage());
}
$ret = $ssdb->set('key', 'value');
if($ret === false){
    // error!
}
echo $ssdb->get('key');

Error Handling

SimpleSSDB throws Exception if it can't connect to SSDB server. Most methods(with some exceptions) return false on error. So one should use Identical Equal(===) to test the return value.

All methods will throw SSDBException on network error.

WARN: make sure all arguments do not exceed 10MB total size.

Methods

SimpleSSDB::__construct

Description

Creates a SSDB client, and connect to SSDB server. Throws exception if it can't connect to the server.

Parameters

host - SSDB server's host/ip address.
port - SSDB server's port number.
timeout_ms - optional, timeout for connect, send/receive data, in milliseconds. Default 2000 ms.

Return Value

The SimpleSSDB instance.

Example

$ssdb = new SimpleSSDB('127.0.0.1', 8888);

auth

Since: 1.7.0.0

Description

Config the password for later use to authenticate the connection. The authentication is not invoked immediately, but later when you send the first request to the server. Warning: The password is sent in plain-text over the network!

Parameters

password -

Return Value

false on error, otherwise returns null.

Example

$ssdb->auth('very-strong-password');

set

Description

Set the value of the key.

Parameters

key -
value -

Return Value

false on error, other values indicate OK.

Example

$ssdb->set('key', 'value');

setx

Description

Set the value of the key, with a time to live.

Parameters

key -
value -
ttl - number of seconds to live.

Return Value

false on error, other values indicate OK.

Example

$ssdb->setx('key', 'value', 60);

setnx

Description

Set the string value in argument as value of the key if and only if the key doesn't exist.

Parameters

key -
value -

Return Value

false on error, 1: value is set, 0: key already exists.

Example

$ssdb->setnx('key', 'value');

expire

Description

Set the time left to live in seconds, only for keys of KV type.

Parameters

key -
ttl - number of seconds to live.

Return Value

false on error, if key exists and ttl is set, return 1, if key not exists, return 0.

Example

$ssdb->expire('key', 60);

ttl

Description

Returns the time left to live in seconds, only for keys of KV type.

Parameters

key -

Return Value

false on error, or time to live of the key, in seconds, -1 if there is no associated expire to the key.

Example

$ssdb->ttl('key');

get

Description

Get the value related to the specified key

Parameters

key -

Return Value

Returns null if key not found, false on error, otherwise, the value related to that key is returned.

Example

$ssdb->get('key');

getset

Description

Sets a value and returns the previous entry at that key.

Parameters

key -
value -

Return Value

Returns null if key not found, false on error, therwise, the value related to that key is returned.

Example

$ssdb->getset('key', 'value');

del

Description

Delete specified key.

Parameters

key -

Return Value

false on error, other values indicate OK. You can not determine whether the key exists or not.

Example

$ssdb->del('key');

incr

Since 1.7.0.1, *incr methods return error if value cannot be converted to integer.

Description

Increment the number stored at key by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer.

Parameters

key -
num - Must be a signed integer.

Return Value

false on error, other values the new value.

Example

$ssdb->incr('key', 1);

exists

Description

Verify if the specified key exists.

Parameters

key -

Return Value

If the key exists, return true, otherwise return false.

Example

$ssdb->exists('key');

getbit

Description

Return a single bit out of a string.

Parameters

key -
offset - bit offset.

Return Value

0 or 1.

Example

$ssdb->getbit('key', 7);

setbit

Description

Changes a single bit of a string. The string is auto expanded.

Parameters

key -
offset - bit offset, must in range of [0, 1073741824].
val - 0 or 1.

Return Value

The value of the bit before it was set: 0 or 1. If val is not 0 or 1, returns false.

Example

$ssdb->setbit('key', 7, 1);

bitcount

Description

Like Redis's bitcount.

Parameters

key -
start - Optional, if start is negative, count from start'th character from the end of string.
end - Optional.

Return Value

The number of bits set to 1.

Example

$ssdb->bitcount('key', 2, 10);

countbit

Description

Count the number of set bits (population counting) in part of a string.

Parameters

key -
start - Optional, if start is negative, count from start'th character from the end of string.
size - Optional, if size is negative, then that many characters will be omitted from the end of string.

Return Value

The number of bits set to 1.

Example

$ssdb->countbit('key', 2, 10);

substr

Description

Return part of a string(like PHP's substr()).

Parameters

key -
start - Optional, the offset of first byte returned. If start is negative, the returned string will start at the start'th character from the end of string.
size - Optional, number of bytes returned. If size is negative, then that many characters will be omitted from the end of string.

Return Value

The extracted part of the string.

Example

$ssdb->substr('key', 2, 10);

strlen

Description

Return the number of bytes of a string.

Parameters

key -

Return Value

The number of bytes of the string, if key not exists, returns 0.

Example

$ssdb->strlen('key');

keys/rkeys

Description

List keys in range (key_start, key_end].

("", ""] means no range limit.

Parameters

key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit).
key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit).
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the keys.

Example

$ssdb->keys('a', 'z', 10);

scan

Description

List key-value pairs with keys in range (key_start, key_end].

("", ""] means no range limit.

Parameters

key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit).
key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit).
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-value pairs.

Example

$ssdb->scan('a', 'z', 10);
Iterate over all key-value pairs
$start = ''; 
$limit = 1000;
while(1){
    $kvs = $ssdb->scan($start, '', $limit);
    if(!$kvs){
        break;
    }
    // do something on key-value pairs...
    $keys = array_keys(array_slice($kvs, -1, 1, true));
    $max_key = $keys[0];
    $start = $max_key;
}

rscan

Description

List key-value pairs with keys in range (key_start, key_end], in reverse order.

("", ""] means no range limit.

Parameters

key_start - The upper bound(not included) of keys to be returned, empty string means +inf(no limit).
key_end - The lower bound(inclusive) of keys to be returned, empty string means -inf(no limit).
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-value pairs.

Example

$ssdb->rscan('a', 'z', 10);

multi_set

Description

Set multiple key-value pairs(kvs) in one method call.

Parameters

kvs - A associative array containing the key-value pairs.

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_set(array(
	'a' => 1,
	'b' => 2,
));

multi_get

Description

Get the values related to the specified multiple keys

Parameters

keys - An array containing keys

Return Value

false on error, otherwise an associative array containing ONLY found keys and values.

Example

$ssdb->multi_get(array('k1', 'k2'));

multi_del

Description

Delete specified multiple keys.

Parameters

keys - An array containing keys

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_del(array('k1', 'k2'));

hset

Description

Set the string value in argument as value of the key of a hashmap.

Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap
value - The value of the key-value pair in the hashmap

Return Value

false on error, other values indicate OK.

Example

$ssdb->hset('h', 'key', 'value');

hget

Description

Get the value related to the specified key of a hashmap

Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap

Return Value

Returns null if key not found, false on error, otherwise, the value related to this key is returned.

Example

$ssdb->hget('h', 'key');

hdel

Description

Delete specified key of a hashmap.

Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap

Return Value

false on error, other values indicate OK. You can not determine whether the key exists or not.

Example

$ssdb->hdel('h', 'key');

hincr

Since 1.7.0.1, *incr methods return error if value cannot be converted to integer.

Description

Increment the number stored at key in a hashmap by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer.

Parameters

name - The name of the hashmap
key -
num - Must be a signed integer.

Return Value

false on error, other values the new value.

Example

$ssdb->hincr('h', 'key', 1);

hexists

Description

Verify if the specified key exists in a hashmap.

Parameters

name - The name of the hashmap
key -

Return Value

If the key exists, return true, otherwise return false.

Example

$ssdb->hexists('h', 'key');

hsize

Description

Return the number of pairs of a hashmap.

Parameters

name - The name of the hashmap

Return Value

false on error, otherwise an integer, 0 if the hashmap does not exist.

Example

$ssdb->hsize('h');

hlist, hrlist

Description

List hashmap names in range (name_start, name_end].

("", ""] means no range limit.

Parameters

name_start - The lower bound(not included) of names to be returned, empty string means -inf(no limit).
name_end - The upper bound(inclusive) of names to be returned, empty string means +inf(no limit).
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the names.

Example

$ssdb->hlist('a', 'z', 10);

hkeys

Description

List keys of a hashmap in range (key_start, key_end].

("", ""] means no range limit.

Parameters

name - The name of the hashmap
key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit).
key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit).
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the keys.

Example

$ssdb->hkeys('h', 'a', 'z', 10);

hgetall

Description

Returns the whole hash, as an array of strings indexed by strings.

Parameters

name - The name of the hashmap

Return Value

false on error, otherwise an associative array containing the key-value pairs.

Example

$ssdb->hgetall('h');

hscan

Description

List key-value pairs of a hashmap with keys in range (key_start, key_end].

("", ""] means no range limit.

Parameters

name - The name of the hashmap
key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit).
key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit).
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-value pairs.

Example

$ssdb->hscan('h', 'a', 'z', 10);

Iterate over a hash:

$start = '';
while(1){
    $kvs = $ssdb->hscan($name, $start, '', 10);
    if(!$kvs){
        break;
    }
    // do sth on kvs here
    
    $keys = array_keys($kvs);
    $start = $keys[count($keys) - 1];
}

hrscan

Description

List key-value pairs of a hashmap with keys in range (key_start, key_end], in reverse order.

("", ""] means no range limit.

Parameters

name - The name of the hashmap
key_start - The upper bound(not included) of keys to be returned, empty string means +inf(no limit).
key_end - The lower bound(inclusive) of keys to be returned, empty string means -inf(no limit).
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-value pairs.

Example

$ssdb->hrscan('h', 'a', 'z', 10);

hclear

Description

Delete all keys in a hashmap.

Parameters

name - The name of the hashmap.

Return Value

false on error, or the number of keys deleted.

Example

$ssdb->hclear('h');

multi_hset

Description

Set multiple key-value pairs(kvs) of a hashmap in one method call.

Parameters

name - The name of the hashmap.
kvs - A associative array containing the key-value pairs.

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_hset('h', array(
	'a' => 1,
	'b' => 2,
));

multi_hget

Description

Get the values related to the specified multiple keys of a hashmap.

Parameters

name - The name of the hashmap.
keys - An array containing keys.

Return Value

false on error, otherwise an associative array containing ONLY found keys and values.

Example

$ssdb->multi_hget('h', array('k1', 'k2'));

multi_hdel

Description

Delete specified multiple keys in a hashmap.

Parameters

name - The name of the hashmap.
keys - An array containing keys.

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_hdel('h', array('k1', 'k2'));

zset

Description

Set the score of the key of a zset.

Parameters

name - The name of the zset
key - The key of the key-score pair in the hashmap
score - The score of the key-score pair in the hashmap

Return Value

false on error, other values indicate OK.

Example

$ssdb->zset('z', 'key', 100);

zget

Description

Get the score related to the specified key of a zset

Parameters

name - The name of the zset
key - The key of the key-score pair in the zset

Return Value

Returns null if key not found, false on error, otherwise, the score related to this key is returned.

Example

$ssdb->zget('z', 'key');

zdel

Description

Delete specified key of a zset.

Parameters

name - The name of the zset
key - The key of the key-score pair in the zset

Return Value

false on error, other values indicate OK. You can not determine whether the key exists or not.

Example

$ssdb->zdel('hz, 'key');

zincr

Description

Increment the number stored at key in a zset by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer.

Parameters

name - The name of the zset
key -
num - Must be a signed integer.

Return Value

false on error, other values the new value.

Example

$ssdb->zincr('z', 'key', 1);

zexists

Description

Verify if the specified key exists in a zset.

Parameters

name - The name of the zset
key -

Return Value

If the key exists, return true, otherwise return false.

Example

$ssdb->zexists('z', 'key');

zsize

Description

Return the number of pairs of a zset.

Parameters

name - The name of the zset

Return Value

false on error, otherwise an integer, 0 if the zset does not exist.

Example

$ssdb->zsize('z');

zlist, zrlist

Description

List zset names in range (name_start, name_end].

("", ""] means no range limit.

Parameters

name_start - The lower bound(not included) of names to be returned, empty string means -inf(no limit).
name_end - The upper bound(inclusive) of names to be returned, empty string means +inf(no limit).
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the names.

Example

$ssdb->zlist('a', 'z', 10);

zkeys

List keys in a zset. See method zscan().

Description

Parameters

name - The name of the zset
key_start - See method zscan().
score_start - See method zscan().
score_end - See method zscan().
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the keys.

Example

$ssdb->zkeys('z', '', 1, 100, 10);

zscan

Description

List key-score pairs in a zset, where key-score in range (key_start+score_start, score_end]. If key_start is empty, keys with a score greater than or equal to score_start will be returned. If key_start is not empty, keys with score larger than score_start, and keys larger than key_start also with score equal to score_start will be returned.

That is: return keys in (key.score == score_start && key > key_start || key.score > score_start), and key.score <= score_end. The score_start, score_end is of higher priority than key_start.

("", ""] means no range limit.

Parameters

name - The name of the zset
key_start - The key related to score_start, could be empty string.
score_start - The minimum score related to keys(may not be included, depend on key_start), empty string means -inf(no limit).
score_end - The maximum score(inclusive) related to keys, empty string means +inf(no limit).
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-score pairs.

Example

$ssdb->zscan('z', '', 1, 100, 10);

Iterate over zset:

$key_start = ''; 
$score_start = ''; 
while(1){
    $items = $ssdb->zscan($zname, $key_start, $score_start, '', 10);
    if(!$items){
        break;
    }   
    foreach($items as $key=>$score){
        // process($key, $score)...

        // remember the currently largest key and its score
        $key_start = $key;
        $score_start = $score;
    }   
}

zrscan

Description

List key-score pairs of a zset, in reverse order. See method zkeys().

Parameters

name - The name of the zset
key_start - See method zkeys().
score_start - See method zkeys().
score_end - See method zkeys().
limit - Up to that many pairs will be returned.

Return Value

false on error, otherwise an associative array containing the key-score pairs.

Example

$ssdb->zrscan('z', '', 100, 1, 10);

zrank, zrrank

Description

Important! This method may be extremly SLOW! May not be used in an online service.

Returns the rank(index) of a given key in the specified sorted set, starting at 0 for the item with the smallest score. zrrank starts at 0 for the item with the largest score.

Parameters

name - The name of the zset.
key -

Return Value

false on error, otherwise the rank(index) of a specified key, start at 0. null if not found.

Example

$ssdb->zrank('z', 'k1');

zrange, zrrange

Description

Important! This method is SLOW for large offset!

Returns a range of key-score pairs by index range [offset, offset + limit). Zrrange iterates in reverse order.

Parameters

name - The name of the zset.
offset - Positive integer, the returned pairs will start at this offset.
limit - Positive integer, up to this number of pairs will be returned.

Return Value

false on error, otherwise an array containing key-score pairs.

Example

$ssdb->zrange('z', 0, 10);

zclear

Description

Delete all keys in a zset.

Parameters

name - The name of the zset.

Return Value

false on error, or the number of keys deleted.

Example

$ssdb->zclear('z');

zcount

Description

Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end].

Parameters

name - The name of the zset.
start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

false on error, or the number of keys in specified range.

Example

$ssdb->zcount('z', 0, 100);

zsum

Description

Returns the sum of elements of the sorted set stored at the specified key which have scores in the range [start,end].

Parameters

name - The name of the zset.
start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

false on error, or the sum of keys in specified range.

Example

$ssdb->zsum('z', 0, 100);

zavg

Description

Returns the average of elements of the sorted set stored at the specified key which have scores in the range [start,end].

Parameters

name - The name of the zset.
start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

false on error, or the average of keys in specified range.

Example

$ssdb->zavg('z', 0, 100);

zremrangebyrank

Description

Delete the elements of the zset which have rank in the range [start,end].

Parameters

name - The name of the zset.
start - inclusive, unsigned number.
end - inclusive, unsigned number.

Return Value

false on error, or the number of deleted elements.

Example

$ssdb->zremrangebyrank('z', 1, 2);

zremrangebyscore

Description

Delete the elements of the zset which have score in the range [start,end].

Parameters

name - The name of the zset.
start - (inclusive).
end - (inclusive).

Return Value

false on error, or the number of deleted elements.

Example

$ssdb->zremrangebyscore('z', 1, 2);

zpop_front

Description

Delete and return `limit` element(s) from front of the zset.

Parameters

name - The name of the zset.
limit - The number of elements to be deleted and returned.

Return Value

false on error, otherwise an array containing key-score pairs.

Example

$ssdb->zpop_front('z', 3);

zpop_back

Description

Delete and return `limit` element(s) from back of the zset.

Parameters

name - The name of the zset.
limit - The number of elements to be deleted and returned.

Return Value

false on error, otherwise an array containing key-score pairs.

Example

$ssdb->zpop_back('z', 3);

multi_zset

Description

Set multiple key-score pairs(kvs) of a zset in one method call.

Parameters

name - The name of the zset.
kvs - A associative array containing the key-score pairs.

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_zset('z', array(
	'a' => 1,
	'b' => 2,
));

multi_zget

Description

Get the values related to the specified multiple keys of a zset.

Parameters

name - The name of the zset.
keys - An array containing keys.

Return Value

false on error, otherwise an associative array containing ONLY found keys and values.

Example

$ssdb->multi_zget('z', array('k1', 'k2'));

multi_zdel

Description

Delete specified multiple keys of a zset.

Parameters

name - The name of the zset.
keys - An array containing keys.

Return Value

false on error, other values indicate OK.

Example

$ssdb->multi_zdel('z', array('k1', 'k2'));

qsize

Description

Returns the number of items in the queue.

Parameters

name -

Return Value

false on error, otherwise an integer, 0 if the queue does not exist.

Example

$ssdb->qsize('q');

qlist, qrlist

Description

List list/queue names in range (name_start, name_end].

("", ""] means no range limit.

Parameters

name_start - The lower bound(not included) of names to be returned, empty string means -inf(no limit).
name_end - The upper bound(inclusive) of names to be returned, empty string means +inf(no limit).
limit - Up to that many elements will be returned.

Return Value

false on error, otherwise an array containing the names.

Example

$ssdb->qlist('a', 'z', 10);

qclear

Description

Clear the queue.

Parameters

name -

Return Value

false on error.

Example

$ssdb->qclear('q');

qfront

Description

Returns the first element of a queue.

Parameters

name -

Return Value

false on error, null if queue empty, otherwise the item returned.

Example

$ssdb->qfront('q');

qback

Description

Returns the last element of a queue.

Parameters

name -

Return Value

false on error, null if queue empty, otherwise the item returned.

Example

$ssdb->qback('q');

qget

Description

Returns the element a the specified index(position). 0 the first element, 1 the second ... -1 the last element.

Parameters

name -
index - negative intexes accepted.

Return Value

false on error, null if no element corresponds to this index, otherwise the item returned.

Example

$ssdb->qget('q', -2);

qset

Since: 1.7.0.0

Description

Sets the list element at index to value. An error is returned for out of range indexes.

Parameters

name -
index - negative intexes accepted.
val -

Return Value

false on error, other values indicate OK.

Example

$ssdb->qset('q', 0, 'new val');

qrange

Description

Returns a portion of elements from the queue at the specified range [offset, offset + limit].

Parameters

name -
offset -
limit -

Return Value

false on error, otherwise an array containing items.

Example

$ssdb->qrange('q', 0, -1);

qslice

Description

Returns a portion of elements from the queue at the specified range [begin, end]. begin and end could be negative.

Parameters

name -
begin -
end -

Return Value

false on error, otherwise an array containing items.

Example

$ssdb->qslice('q', 0, -1);

qpush

Description

This function is an alias of: qpush_back().

qpush_front

Description

Adds one or more than one element to the head of the queue.

Parameters

name -
item - string or array of string.

Return Value

The length of the list after the push operation, false on error.

Example

$ssdb->qpush_front('q', 'a');

qpush_back

Description

Adds an or more than one element to the end of the queue.

Parameters

name -
item - string or array of string.

Return Value

The length of the list after the push operation, false on error.

Example

$ssdb->qpush_back('q', 'a');

qpop

Description

This function is an alias of: qpop_front().

qpop_front

Description

Pop out one or more elements from the head of a queue.

Parameters

name -
size - optional, number of elements to pop, default is 1

Return Value

false on error. When size is not specified or less than 2, returns null if queue empty, otherwise the item removed. When size is specified and greater than or equal to 2, returns an array of elements removed.

Example

$ssdb->qpop_front('q');

qpop_back

Description

Pop out one or more elements from the tail of a queue.

Parameters

name -
size - optional, number of elements to pop, default is 1

Return Value

false on error. When size is not specified or less than 2, returns null if queue empty, otherwise the item removed. When size is specified and greater than or equal to 2, returns an array of elements removed.

Example

$ssdb->qpop_back('q');

qtrim_front

Description

Remove multi elements from the head of a queue.

Parameters

name -
size - number of elements to delete.

Return Value

false on error. Return the number of elements removed.

Example

$ssdb->qtrim_front('q', 3);

qtrim_back

Description

Remove multi elements from the tail of a queue.

Parameters

name -
size - number of elements to delete.

Return Value

false on error. Return the number of elements removed.

Example

$ssdb->qtrim_back('q', 3);

batch, exec

Description

Execute a batch of commands. Batch Commands can reduce the round trip time(rtt) between SSDB client and the server.

This feature is implemented in client side, the ssdb-server does not support batch command execution. The server will execute each command as if they are separated. The total amount of the commands and arguments must be less than 10MB.

Parameters

Return Value

exec() returns false on error, otherwise an array of results corresponding to each of the batch commands.

Example

$ret = $ssdb->batch()
	->set('a', 1)
	->get('a')
	->exec();
// or
$ssdb->batch();
$ssdb->set('a', 1);
$ssdb->get('a');
$ret = $ssdb->exec();

dbsize

Description

Return the approximate size of the database, in bytes. If compression is enabled, the size will be of the compressed data.

Parameters

Return Value

false on error. Return approximate size of the database, in bytes.

Example

$ssdb->dbsize();

info

Description

Return information about the server.

Parameters

opt - optional, could be cmd, leveldb

Return Value

false on error. Return an associative array of information about the server.

Example

$ssdb->info();