{"id":36994457,"url":"https://github.com/torden/php-mdbm","last_synced_at":"2026-01-13T23:46:41.023Z","repository":{"id":56858279,"uuid":"115495427","full_name":"torden/php-mdbm","owner":"torden","description":"Just! PHP interface for Y! MDBM , PHP mdbm wrapper","archived":false,"fork":false,"pushed_at":"2022-09-02T04:00:41.000Z","size":1410,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-25T14:01:45.942Z","etag":null,"topics":["database","dbm","key-value","mdbm","php","php-mdbm","phpmdbm"],"latest_commit_sha":null,"homepage":"https://torden.github.io/php-mdbm/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/torden.png","metadata":{"files":{"readme":"README.api.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-27T07:40:08.000Z","updated_at":"2022-09-09T17:03:13.000Z","dependencies_parsed_at":"2022-09-09T15:23:21.790Z","dependency_job_id":null,"html_url":"https://github.com/torden/php-mdbm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/torden/php-mdbm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torden%2Fphp-mdbm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torden%2Fphp-mdbm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torden%2Fphp-mdbm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torden%2Fphp-mdbm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/torden","download_url":"https://codeload.github.com/torden/php-mdbm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torden%2Fphp-mdbm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","dbm","key-value","mdbm","php","php-mdbm","phpmdbm"],"created_at":"2026-01-13T23:46:40.883Z","updated_at":"2026-01-13T23:46:41.014Z","avatar_url":"https://github.com/torden.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Document\n\nSee the [MDBM API Document](http://yahoo.github.io/mdbm/api/modules.html) for more details\n\n(PHP \u003e= 5.6.x, PHP7)\n\n## Table of Contents\n\n- [Basic](#basic)\n\t- [mdbm_open](#mdbm_open)\n\t- [mdbm_close](#mdbm_close)\n\t- [mdbm_store](#mdbm_store)\n\t- [mdbm_fetch](#mdbm_fetch)\n\t- [mdbm_delete](#mdbm_delete)\n- [Additional](#additional-api)\n \t- [mdbm_get_iter](#mdbm_get_iter)\n\t- [mdbm_get_global_iter](#mdbm_get_global_iter)\n\t- [mdbm_reset_global_iter](#mdbm_reset_global_iter)\n- [Examples](#examples)\n    - [Creating and populating a database](#creating-and-populating-a-database)\n    - [Fetching records in-place](#fetching-records-in-place)\n    - [Replacing(Updating) value of records in-place](#replacing(updating)-value-of-records-in-place)\n    - [Deleting records in-place](#deleting-records-in-place)\n    - [Adding/replacing records](#adding/replacing-records)\n    - [Iterating over all records](#iterating-over-all-records)\n    - [Iterating over all keys](#iterating-over-all-keys)\n- [Constants](#constants)\n\t- [Global](#global)\n\t- [For API](#for-api)\n- [Link](#link)\n\n## Basic\n\n### mdbm_open\n\n`mdbm_open` - Creates and/or opens a database\n\n#### Description\n\n```php\nresource mdbm_open(string $filename, int flags, int $mode [, int psize[, int presize ]]);\n```\n\n#### Parameters\n\n- **file** : Name of the backing file for the database.\n- **flags** : Specifies the open-mode for the file, usually either (MDBM_O_RDWR|MDBM_O_CREAT) or (MDBM_O_RDONLY).\n```\nFlag MDBM_LARGE_OBJECTS may be used to enable large object support.\nLarge object support can only be enabled when the database is first created.\nSubsequent mdbm_open calls will ignore the flag.\nFlag MDBM_PARTITIONED_LOCKS may be used to enable\npartition locking a per mdbm_open basis.\nValues for flags mask:\n  - MDBM_O_RDONLY          - open for reading only\n  - MDBM_O_RDWR            - open for reading and writing\n  - MDBM_O_WRONLY          - same as RDWR (deprecated)\n  - MDBM_O_CREAT           - create file if it does not exist (requires flag MDBM_O_RDWR)\n  - MDBM_O_TRUNC           - truncate size to 0\n  - MDBM_O_ASYNC           - enable asynchronous sync'ing by the kernel syncing process.\n  - MDBM_O_FSYNC           - sync MDBM upon mdbm_close\n  - MDBM_O_DIRECT          - use O_DIRECT when accessing backing-store files\n  - MDBM_NO_DIRTY          - do not not track clean/dirty status\n  - MDBM_OPEN_WINDOWED     - use windowing to access db, only available with MDBM_O_RDWR\n  - MDBM_PROTECT           - protect database except when locked (MDBM V3 only)\n  - MDBM_DBSIZE_MB         - dbsize is specific in MB (MDBM V3 only)\n  - MDBM_LARGE_OBJECTS     - support large objects\n  - MDBM_PARTITIONED_LOCKS - partitioned locks\n  - MDBM_RW_LOCKS          - read-write locks\n  - MDBM_CREATE_V2         - create a V2 db (obsolete)\n  - MDBM_CREATE_V3         - create a V3 db\n  - MDBM_HEADER_ONLY       - map header only (internal use)\n  - MDBM_OPEN_NOLOCK       - do not lock during open\n  - MDBM_ANY_LOCKS         - (V4 only) treat the locking flags as only a suggestion\n  - MDBM_SINGLE_ARCH       - (V4 only) user guarantees no mixed (32/64-bit) access in exchange for faster (pthreads) locking\n```\n- **mode** Used to set the file permissions if the file needs to be created.\n- **psize** Specifies the page size for the database and is set when the database is created.\n```\nThe minimum page size is 128.\nIn v2, the maximum is 64K.\nIn v3, the maximum is 16M - 64.\nThe default, if 0 is specified, is 4096.\n```\n- **presize** Specifies the initial size for the database.\n```\nThe database will dynamically grow as records are added, but specifying an initial size may improve efficiency.\nIf this is not a multiple of psize, it will be increased to the next psize multiple.\n```\n\n#### Return Values\n\nReturns an MDBM Handler, *FALSE* on errors.\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_CREATE | MDBM_O_RDWR, 0644);\n```\n\n\n### mdbm_close\n\n`mdbm_close` - Closes the database.\n\n#### Description\n\n```php\nmdbm_close(resource $db);\n```\n\n\u003e mdbm_close closes the database specified by the db argument.\n\u003e The in-memory pages are not flushed to disk by close.\n\u003e They will be written to disk over time as they are paged out,\n\u003e but an explicit mdbm_sync call is necessary before closing if on-disk consistency is required.\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n#### Return Values\n\nN/A\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_RDWR, 0644);\nmdbm_close($db);\n```\n\n### mdbm_store\n\n`mdbm_store` - Stores the record specified by the key and val parameters.\n\n#### Description\n\n```php\nbool mdbm_store(resource db, string key, string val, int flags);\n```\n\u003e This is a wrapper around mdbm_store_r, with a static iterator.\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n**key**\n\u003e Stored key\n\n**val**\n\u003e Key's value\n\n**flags**\n\u003e Store flags\n```\nValues for flags mask:\n  - MDBM_INSERT - Operation will fail if a record with the same key\n    already exists in the database.\n  - MDBM_REPLACE - A record with the same key will be replaced.\n    If the key does not exist, the record will be created.\n  - MDBM_INSERT_DUP - allows multiple records with the same key to be inserted.\n    Fetching a record with the key will return only one of the duplicate\n    records, and which record is returned is not defined.\n  - MDBM_MODIFY - Store only if matching entry already exists.\n  - MDBM_RESERVE - Reserve space; value not copied (\\ref mdbm_store_r only)\n  - MDBM_CACHE_ONLY  - Perform store only in the Cache, not in Backing Store.\n  - MDBM_CACHE_MODIFY  - Update Cache only if key exists; update the Backing Store\n```\n\n#### Return Values\n\n Returns **TRUE** on success or **FALSE** on failure.\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_CREATE | MDBM_O_RDWR, 0644);\n$rv = mdbm_store($db, \"ABC\", \"CBA\", MDBM_INSERT);\n$rv = mdbm_store($db, \"123\", \"456\", MDBM_INSERT_DUP);\n$rv = mdbm_store($db, \"123\", \"4567\", MDBM_INSERT_DUP);\n$rv = mdbm_store($db, \"123\", \"45678\", MDBM_INSERT_DUP);\n$rv = mdbm_store($db, \"ABC\", \"PHP\", MDBM_REPLACE);\nmdbm_close($db)\n```\n\n### mdbm_fetch\n\n`mdbm_fetch` -  Fetches the record specified by the key argument and returns a string that value of key.\n\n\n#### Description\n\n```php\nstring or bool mdbm_fetch(resource db, string key);\n```\n\n\u003e Fetches the record specified by the key argument and returns a string that the value of key.\n\u003e The contents returned in string has a value in mapped memory.\n\u003e If there is any system-wide process that could modify your MDBM, this value must be accessed in a locked context.\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n**key**\n\u003e key Lookup key\n\n\n#### Return Values\n\nReturns an string, *FALSE* on errors.\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_RDONLY, 0644);\n$val = mdbm_fetch($db, \"ABC\");\nprint_r($val);\nmdbm_close($db);\n```\n\n\n### mdbm_delete\n\n`mdbm_delete` - Deletes a specific record.\n\n\n#### Description\n\n```php\nbool mdbm_delete(resource db, string key);\n```\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n**key**\n\u003e key Lookup key\n\n\n#### Return Values\n\nReturns an string, *FALSE* on errors.\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_RDONLY, 0644);\n$rv = mdbm_delete($db, \"ABC\");\nprint_r($rv);\nmdbm_close($db);\n```\n\n## Additional API\n\n### mdbm_get_iter\n\n`mdbm_get_iter` - Returns an Initialized Iterator\n\n#### Description\n\n```php\narray mdbm_get_iter(resource $db);\n```\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n#### Return Values\n\nReturns an Initialized Iterator, *FALSE* on errors.\n\nThe properties of the array are:\n\n- **___pageno** : fetched last number of page\n- **___next** : Index for getnext\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_CREATE | MDBM_O_RDWR, 0644);\n$rv = mdbm_store($db, \"ABC\", \"CBA\");\n$rv = mdbm_store($db, \"123\", \"456\");\n$rv = mdbm_store($db, \"Hello\", \"PHP\");\n$iter = mdbm_get_iter($db);\nprint_r($iter)\n\n$mkv = mdbm_next_r($db, $iter);\nprint_r($mkv);\n```\n\n### mdbm_get_global_iter\n\n`mdbm_get_global_iter` - Returns the Value of Global Iterator\n\n#### Description\n\n```php\narray mdbm_get_global_iter(resource $db);\n```\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n#### Return Values\n\nReturns the Value of Global Iterator , *FALSE* on errors.\n\nThe properties of the array are:\n\n- **___pageno** : fetched last number of page\n- **___next** : Index for getnext\n\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_RDONLY, 0644);\n\n$kv = mdbm_first($db)\nwhile($kv) {\n\t$iter = mdbm_get_global_iter($db);\n\tprint_r($iter)\n\n\tprint_r($kv);\n\t$kv = mdbm_next($db)\n}\n```\n\n### mdbm_reset_global_iter\n\n`mdbm_reset_global_iter` - Resets the Global Iterator\n\n#### Description\n\n```php\nmdbm_reset_global_iter(resource $db);\n```\n\n#### Parameters\n\n**db**\n\u003e *The MDBM Handler*\n\n#### Return Values\n\nN/A\n\n#### Example\n\n```php\n$db = mdbm_open(\"/tmp/test.mdbm\", MDBM_O_RDONLY, 0644);\n\n$kv = mdbm_first($db)\nwhile($kv) {\n\tprint_r($kv);\n\t$kv = mdbm_next($db)\n}\n\nmdbm_reset_global_iter($db);\n\n$kv = mdbm_next($db)\nwhile($kv) {\n\tprint_r($kv);\n\t$kv = mdbm_next($db)\n}\n\nmdbm_reset_global_iter($db);\n$kv = mdbm_next($db);\nprint_r($kv);\n```\n\n## Examples\n\n### Creating and populating a database\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR|MDBM_O_CREAT|MDBM_LARGE_OBJECTS|MDBM_O_TRUNC|MDBM_ANY_LOCKS, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to create database\";\n    exit(2);\n}\n\nmdbm_lock($db);\n\nfor($i=0;$i\u003c65535;$i++) {\n\n    $v = rand(1,65535);\n    //$rv = mdbm_store($db, $i, $v, MDBM_INSERT); same below\n    $rv = mdbm_store($db, $i, $v);\n    if($rv === false) {\n        echo \"failed to store\";\n        break;\n    }\n}\n\nmdbm_unlock($db);\n\nmdbm_sync(); //optional flush to disk\nmdbm_close($db);\n?\u003e\n```\n\n### Fetching records in-place\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\nfor($i=0;$i\u003c65535;$i++) {\n\n    $v = rand(1,65535);\n    $val = mdbm_fetch($db, $v);\n    if($val === false) {\n        echo \"failed to store\";\n        break;\n    }\n\n    printf(\"store : val=%s\\n\", $val);\n}\n\nmdbm_close($db);\n?\u003e\n```\n\n### Replacing(Updating) value of records in-place\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\nfor($i=0;$i\u003c10;$i++) {\n\n    $val = mdbm_fetch($db, $i);\n    if($val === false) {\n        echo \"failed to fetch\";\n        break;\n    }\n\n    $v = rand(1,65535);\n\n    printf(\"replace : val=%s to %s\\n\", $val, $v);\n\n    $rv = mdbm_store($db, $v, MDBM_REPLACE);\n    if($rv === false) {\n        echo \"failed to store(replace)\";\n        break;\n    }\n}\n\nmdbm_close($db);\n?\u003e\n```\n\n### Deleting records in-place\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\nfor($i=0;$i\u003c10;$i++) {\n\n    $v = rand(1,65535);\n    $val = mdbm_fetch($db, $v);\n    if($val == false) {\n        echo \"failed to fetch\";\n        break;\n    }\n\n    printf(\"delete : val=%s\\n\", $val);\n\n    $rv = mdbm_delete($db, $v);\n    if($rv === false) {\n        echo \"failed to delete\";\n        break;\n    }\n}\n\nmdbm_sync(); //optional flush to disk\nmdbm_close($db);\n?\u003e\n```\n\n\n### Adding/replacing records\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\nfor($i=65536;$i\u003c655360;$i++) {\n\n    mdbm_lock($db);\n    $rv = mdbm_store($db, $v, MDBM_REPLACE);\n    mdbm_unlock($db);\n\n    if($rv === false) {\n        echo \"failed to store(replace)\";\n        break;\n    }\n}\n\nmdbm_close($db);\n?\u003e\n```\n\n\n### Iterating over all records\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\n$kv = mdbm_first($db);\nif($kv === false) {\n    echo \"failed to get a first record\";\n}\n\nwhile($kv) {\n\n    print_r($kv);\n    $kv = mdbm_next($db);\n}\n\n$rv = mdbm_close($db);\nif ($rv === false) {\n    FAIL();\n}\n?\u003e\n```\n\n\n### Iterating over all keys\n\n```php\n\u003c?php\n$db = mdbm_open(\"/tmp/test1.mdbm\", MDBM_O_RDWR, 0666, 0,0);\nif($db === false) {\n    echo \"Unable to open database\";\n    exit(2);\n}\n\n$key = mdbm_firstkey($db);\nif($key === false) {\n    echo \"failed to get a first record\";\n}\n\nwhile($key != false) {\n\n    echo \"$kv\\n\";\n    $key = mdbm_nextkey($db);\n}\n\n$rv = mdbm_close($db);\nif ($rv === false) {\n    FAIL();\n}\n?\u003e\n```\n\n## Constants\n\nThese constants are defined by the py-mdbm.\n\n### Global\n\n|*Constants*|*Comment*|\n|:--|:--|\n|PHP_MDBM_VERSION|php-mdbm's version|\n|MDBM_API_VERSION|mdbm api version|\n|MDBM_KEYLEN_MAX|Maximum key size|\n|MDBM_VALLEN_MAX|Maximum key size|\n|MDBM_O_RDONLY           |Read-only access |\n|MDBM_O_WRONLY           |Write-only access (deprecated in V3) |\n|MDBM_O_RDWR             |Read and write access |\n|MDBM_O_ACCMODE          |MDBM_O_RDONLY \u0026#124; MDBM_O_WRONLY \u0026#124; MDBM_O_RDW|\n|MDBM_O_CREAT            |Create file if it does not exist |\n|MDBM_O_TRUNC            |Truncate file |\n|MDBM_O_FSYNC            |Sync file on close |\n|MDBM_O_ASYNC            |Perform asynchronous writes |\n|MDBM_O_DIRECT           |Perform direction I/O |\n|MDBM_NO_DIRTY           |Do not not track clean/dirty status |\n|MDBM_SINGLE_ARCH        |User *promises* not to mix 32/64-bit access |\n|MDBM_OPEN_WINDOWED      |Use windowing to access db |\n|MDBM_PROTECT            |Protect database except when locked |\n|MDBM_DBSIZE_MB          |Dbsize is specific in MB |\n|MDBM_STAT_OPERATIONS    |collect stats for fetch, store, delete |\n|MDBM_LARGE_OBJECTS      |Support large objects - obsolete |\n|MDBM_PARTITIONED_LOCKS  |Partitioned locks |\n|MDBM_RW_LOCKS           |Read-write locks |\n|MDBM_ANY_LOCKS          |Open, even if existing locks don't match flags |\n|MDBM_OPEN_NOLOCK        |Don't lock during open |\n|MDBM_MINPAGE    |Size should be \u003e= header, but this cuts off header stats, which is ok|\n|MDBM_MAXPAGE    |Maximum page size is 16MB-64bytes, because any page size above that would be rounded to 16MB, which does not fit in the 24 bits allocated for the in-page offset to an object|\n|MDBM_PAGESIZ    |A good default. Size should be \u003e= header|\n|MDBM_DEFAULT_HASH|MDBM_HASH_FNV is best|\n\n\n### For API\n\n|*API*|*Parameter or Return Value*|*Constants*|*Comment*|\n|:--|:--|:--|:--|\n|mdbm_fcopy|flags|MDBM_COPY_LOCK_ALL|Whether lock for the duration of the copy.For a consistent snapshot of the entire database, this flag must be. Otherwise, consistency will only be on a per-page level.|\n|mdbm_get_alignment,\u003cbr\u003emdbm_set_alignment|return value OR align parameter |MDBM_ALIGN_8_BITS       |1-Byte data alignment|\n|||MDBM_ALIGN_16_BITS      |2-Byte data alignment|\n|||MDBM_ALIGN_32_BITS      |4-Byte data alignment|\n|||MDBM_ALIGN_64_BITS      |8-Byte data alignment|\n|mdbm_get_magic_number|return value|_MDBM_MAGIC             |V2 file identifier |\n|||_MDBM_MAGIC_NEW         |V2 file identifier with large objects|\n|||_MDBM_MAGIC_NEW2        |V3 file identifier|\n|||MDBM_MAGIC              |=_MDBM_MAGIC_NEW2|\n|mdbm_store|flags|MDBM_INSERT     \t|Insert if key does not exist; fail if exists |\n|||MDBM_REPLACE    \t|Update if key exists; insert if does not exist |\n|||MDBM_INSERT_DUP \t|Insert new record (creates duplicate if key exists) |\n|||MDBM_MODIFY     \t|Update if key exists; fail if does not exist |\n|||MDBM_STORE_MASK \t|Mask for all store options |\n|||MDBM_RESERVE    \t|Reserve space; Value not copied |\n|||MDBM_CLEAN      \t|Mark entry as clean |\n|||MDBM_CACHE_ONLY \t|Do not operate on the backing store; use cache only |\n|||MDBM_CACHE_REPLACE  |Update cache if key exists; insert if does not exist |\n|||MDBM_CACHE_MODIFY   |Update cache if key exists; do not insert if does not |\n|mdbm_store\u003cbr\u003emdbm_store_r|flags|MDBM_INSERT     \t|Insert if key does not exist; fail if exists |\n|||MDBM_REPLACE    \t|Update if key exists; insert if does not exist |\n|||MDBM_INSERT_DUP \t|Insert new record (creates duplicate if key exists) |\n|||MDBM_MODIFY     \t|Update if key exists; fail if does not exist |\n|||MDBM_STORE_MASK \t|Mask for all store options |\n|||MDBM_RESERVE    \t|Reserve space; Value not copied |\n|||MDBM_CLEAN      \t|Mark entry as clean |\n|||MDBM_CACHE_ONLY \t|Do not operate on the backing store; use cache only |\n|||MDBM_CACHE_REPLACE  |Update cache if key exists; insert if does not exist |\n|||MDBM_CACHE_MODIFY   |Update cache if key exists; do not insert if does not |\n|mdbm_check|level|MDBM_CHECK_HEADER|Check MDBM header for integrity |\n|||MDBM_CHECK_CHUNKS    |Check MDBM header and chunks (page structure) |\n|||MDBM_CHECK_DIRECTORY |Check MDBM header, chunks, and directory |\n|||MDBM_CHECK_ALL       |Check MDBM header, chunks, directory, and data  |\n|mdbm_protect|protect|MDBM_PROT_NONE          |Page no access |\n|||MDBM_PROT_READ          |Page read access |\n|||MDBM_PROT_WRITE         |Page write access |\n|||MDBM_PROT_NOACCESS      |Page no access (=MDBM_PROT_NONE)|\n|||MDBM_PROT_ACCESS        |Page protection mask |\n|mdbm_enable_stat_operations,mdbm_set_stats_func|falgs|MDBM_STATS_BASIC  |enables gathering only the stats counters.|\n|||MDBM_STATS_TIMED  |enables gathering only the stats timestamps.|\n|||(MDBM_STATS_BASIC \u0026#124; MDBM_STATS_TIMED) | enables both the stats counters and timestamps.|\n|mdbm_set_stat_time_func|flags|MDBM_CLOCK_TSC|Enables use of TSC|\n|||MDBM_CLOCK_STANDARD|Disables use of TSC|\n|mdbm_set_stats_func|flags|MDBM_STAT_TAG_FETCH             |Successful fetch stats-callback counter |\n|||MDBM_STAT_TAG_STORE             |Successful store stats-callback counter |\n|||MDBM_STAT_TAG_DELETE            |Successful delete stats-callback counter |\n|||MDBM_STAT_TAG_LOCK              |lock stats-callback counter (not implemented) |\n|||MDBM_STAT_TAG_FETCH_UNCACHED    |Cache-miss with cache+backingstore |\n|||MDBM_STAT_TAG_GETPAGE           |Generic access counter in windowed mode |\n|||MDBM_STAT_TAG_GETPAGE_UNCACHED  |Windowed-mode \"miss\" (load new page into window) |\n|||MDBM_STAT_TAG_CACHE_EVICT       |Cache evict stats-callback counter |\n|||MDBM_STAT_TAG_CACHE_STORE       |Successful cache store counter (BS only) |\n|||MDBM_STAT_TAG_PAGE_STORE        |Successful page-level store indicator |\n|||MDBM_STAT_TAG_PAGE_DELETE       |Successful page-level delete indicator |\n|||MDBM_STAT_TAG_SYNC              |Counter of mdbm_syncs and fsyncs |\n|||MDBM_STAT_TAG_FETCH_NOT_FOUND   |Fetch cannot find a key in MDBM |\n|||MDBM_STAT_TAG_FETCH_ERROR       |Error occurred during fetch |\n|||MDBM_STAT_TAG_STORE_ERROR       |Error occurred during store (e.g. MODIFY failed) |\n|||MDBM_STAT_TAG_DELETE_FAILED     |Delete failed: cannot find a key in MDBM |\n|||MDBM_STAT_TAG_FETCH_LATENCY|Fetch latency (expensive to collect)|\n|||MDBM_STAT_TAG_STORE_LATENCY|Store latency (expensive to collect)|\n|||MDBM_STAT_TAG_DELETE_LATENCY|Delete latency (expensive to collect)|\n|||MDBM_STAT_TAG_FETCH_TIME|timestamp of last fetch (not yet implemented)|\n|||MDBM_STAT_TAG_STORE_TIME|timestamp of last store (not yet implemented)|\n|||MDBM_STAT_TAG_DELETE_TIME|timestamp of last delete (not yet implemented)|\n|||MDBM_STAT_TAG_FETCH_UNCACHED_LATENCY|Cache miss latency for cache+Backingstore only (expensive to collect)|\n|||MDBM_STAT_TAG_GETPAGE_LATENCY|access latency in windowed mode (expensive to collect)|\n|||MDBM_STAT_TAG_GETPAGE_UNCACHED_LATENCY|windowed-mode miss latency (expensive to collect)|\n|||MDBM_STAT_TAG_CACHE_EVICT_LATENCY|cache evict latency (expensive to collect)|\n|||MDBM_STAT_TAG_CACHE_STORE_LATENCY|Cache store latency in Cache+backingstore mode only (expensive to collect)|\n|||MDBM_STAT_TAG_PAGE_STORE_VALUE|Indicates a store occurred on a particular page.  Value returned by callback is the page number. It is up to the callback function to maintain a per-page count||\n|||MDBM_STAT_TAG_PAGE_DELETE_VALUE|Indicates a delete occurred on a particular page.  Value returned by callback is the page number.  It is up to the callback function to maintain a per-page count|\n|||MDBM_STAT_TAG_SYNC_LATENCY|mdbm_sync/fsync latency (expensive to collect)|\n|mdbm_set_cachemode\u003cbr\u003emdbm_get_cachemode| cachemode, return value|MDBM_CACHEMODE_NONE     \t\t\t|No caching behavior |\n|||MDBM_CACHEMODE_LFU      \t\t\t|Entry with smallest number of accesses is evicted |\n|||MDBM_CACHEMODE_LRU      \t\t\t|Entry with oldest access time is evicted |\n|||MDBM_CACHEMODE_GDSF\t            |Greedy dual-size frequency (size and frequency) eviction |\n|mdbm_set_cachemode| cachemode|MDBM_CACHEMODE_MAX      \t\t\t|Maximum cache mode value |\n|mdbm_set_cachemode| cachemode|MDBM_CACHEMODE_EVICT_CLEAN_FIRST |add to cachemode to evict clean items 1st |\n|mdbm_get_hash_value\u003cbr\u003emdbm_set_hash|hashFunctionCode, hashid|MDBM_HASH_CRC32   |Table based 32bit CRC|\n|||MDBM_HASH_EJB     |From hsearch|\n|||MDBM_HASH_PHONG   |Congruential hash|\n|||MDBM_HASH_OZ      |From sdbm|\n|||MDBM_HASH_TOREK   |From BerkeleyDB|\n|||MDBM_HASH_FNV     |Fowler/Vo/Noll hash (DEFAULT)|\n|||MDBM_HASH_STL     |STL string hash|\n|||MDBM_HASH_MD5     |MD5|\n|||MDBM_HASH_SHA_1   |SHA_1|\n|||MDBM_HASH_JENKINS |Jenkins string|\n|||MDBM_HASH_HSIEH   |Hsieh SuperFast|\n|mdbm_log_minlevel|flag|MDBM_LOG_OFF|Off|\n|||MDBM_LOG_EMERGENCY      |EMERG|\n|||MDBM_LOG_ALERT          |action must be taken immediately|\n|||MDBM_LOG_CRITICAL       |critical conditions|\n|||MDBM_LOG_ERROR          |error conditions|\n|||MDBM_LOG_WARNING        |warning conditions|\n|||MDBM_LOG_NOTICE         |normal but signification condition|\n|||MDBM_LOG_INFO           |informational|\n|||MDBM_LOG_DEBUG          |debug-level messages|\n|||MDBM_LOG_DEBUG2         |DEBUG+1|\n|||MDBM_LOG_DEBUG3         |DEBUG+2|\n|||MDBM_LOG_MAXLEVEL       |DEBUG+3|\n|||MDBM_LOG_ABORT          |=MDBM_LOG_EMERGENCY|\n|||MDBM_LOG_FATAL          |=MDBM_LOG_ALERT|\n\n\n\n## Link\n\n- [Yahoo! MDBM](https://github.com/yahoo/mdbm)\n- [MDBM::Concept](http://yahoo.github.io/mdbm/guide/concepts.html)\n- [MDBM::Build](https://github.com/yahoo/mdbm/blob/master/README.build)\n- [MDBM::Document](http://yahoo.github.io/mdbm/)\n- [MDBM::FAQ](http://yahoo.github.io/mdbm/guide/faq.html)\n- [DBM](https://en.wikipedia.org/wiki/Dbm)\n- [MDBM::Macro(const)](http://yahoo.github.io/mdbm/api/mdbm_8h.html)\n- [Go-mdbm](https://github.com/torden/go-mdbm)\n- [Py-mdbm](https://github.com/torden/py-mdbm)\n\n---\n*Please feel free. I hope it is helpful for you*\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorden%2Fphp-mdbm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorden%2Fphp-mdbm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorden%2Fphp-mdbm/lists"}