Jump to content

CDB: Difference between revisions

From mediawiki.org
Content deleted Content added
happened!
package was renamed
Line 2: Line 2:


== Installing ==
== Installing ==
To use it inside your application, simply run <code>composer require cdb/cdb</code>, or add a dependency in your <code>composer.json</code>.
To use it inside your application, simply run <code>composer require wikimedia/cdb</code>, or add a dependency in your <code>composer.json</code>. The current stable version is 1.0.1.


If you prefer using git, that's also an option: <code>git clone https://gerrit.wikimedia.org/r/p/cdb.git</code>, and autoload the library however you wish to.
If you prefer using git, that's also an option: <code>git clone https://gerrit.wikimedia.org/r/p/cdb.git</code>, and autoload the library however you wish to.
Line 31: Line 31:
* http://laxstrom.name/blag/?s=cdb
* http://laxstrom.name/blag/?s=cdb
* http://cr.yp.to/cdb.html
* http://cr.yp.to/cdb.html
* https://packagist.org/packages/cdb/cdb
* https://packagist.org/packages/wikimedia/cdb


[[Category:Database]]
[[Category:Database]]

Revision as of 00:24, 9 December 2014

CDB, short for "constant database", refers to a very fast and highly reliable database system which uses a simple file with key value pairs. In MediaWiki 1.16 (r52203), a PHP port of CDB was added. Starting with MediaWiki 1.25, it was split out into a separate library which can be used independently of MediaWiki.

Installing

To use it inside your application, simply run composer require wikimedia/cdb, or add a dependency in your composer.json. The current stable version is 1.0.1.

If you prefer using git, that's also an option: git clone https://gerrit.wikimedia.org/r/p/cdb.git, and autoload the library however you wish to.

If you wish to develop and contribute on the library, see developer access for gaining access to our code review system.

Usage

// Reading a CDB file
$cdb = \Cdb\Reader::open( 'db.cdb' );
$foo = $cdb->get( 'somekey' );

// Writing to a CDB file
$cdb = \Cdb\Writer::open( 'anotherdb.cdb' );
$cdb->set( 'somekey', $foo );

For actual usage examples, you can look at the following uses within MediaWiki:

See also