{"id":15286132,"url":"https://github.com/kentnl/chi-driver-lmdb","last_synced_at":"2026-01-04T17:49:49.612Z","repository":{"id":20474846,"uuid":"23752484","full_name":"kentnl/CHI-Driver-LMDB","owner":"kentnl","description":"use OpenLDAPs LMDB Key-Value store as a cache backend","archived":false,"fork":false,"pushed_at":"2017-03-05T13:46:11.000Z","size":2631,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T04:42:45.802Z","etag":null,"topics":["perl"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kentnl.png","metadata":{"files":{"readme":"README.mkdn","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-07T04:34:19.000Z","updated_at":"2017-12-01T18:07:21.000Z","dependencies_parsed_at":"2022-07-31T21:18:02.917Z","dependency_job_id":null,"html_url":"https://github.com/kentnl/CHI-Driver-LMDB","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FCHI-Driver-LMDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FCHI-Driver-LMDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FCHI-Driver-LMDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentnl%2FCHI-Driver-LMDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentnl","download_url":"https://codeload.github.com/kentnl/CHI-Driver-LMDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245169925,"owners_count":20571980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["perl"],"created_at":"2024-09-30T15:10:43.242Z","updated_at":"2026-01-04T17:49:49.576Z","avatar_url":"https://github.com/kentnl.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nCHI::Driver::LMDB - use OpenLDAPs LMDB Key-Value store as a cache backend.\n\n# VERSION\n\nversion 0.002005\n\n# SYNOPSIS\n\n    use CHI;\n\n    my $cache = CHI-\u003enew(\n      driver =\u003e 'LMDB',\n      root_dir =\u003e 'some/path',\n      namespace =\u003e \"My::Project\",\n    );\n\nSee [`CHI` documentation](https://metacpan.org/pod/CHI) for more details on usage.\n\n# ATTRIBUTES\n\n## `dir_create_mode`\n\nWhat mode (if any) to use when creating `root_dir` if it does not exist.\n\n    -\u003enew(\n      # Default is 775 = rwxr-xr-x\n      dir_create_mode =\u003e oct 666,\n    );\n\n## `root_dir`\n\nThe prefix directory the `LMDB` data store will be installed to.\n\n    -\u003enew(\n      root_dir =\u003e 'some/path'\n    )\n\nDefault is:\n\n    OSTEMPDIR/chi-driver-lmdb-$EUID\n\n## `cache_size`\n\nThe size in bytes for each database.\n\nThis is a convenience wrapper for [\"mapsize\"](#mapsize) which supports suffixes:\n\n    cache_size =\u003e 5  # 5 bytes\n    cache_size =\u003e 5k # 5 Kilobytes\n    cache_size =\u003e 5m # 5 Megabytes ( default )\n\nThis is also designed for syntax compatibility with [`CHI::Driver::FastMmap`](https://metacpan.org/pod/CHI::Driver::FastMmap)\n\n## `single_txn`\n\n    single_txn =\u003e 1\n\n**SPEED**: For performance benefits, have a single transaction\nthat lives from the creation of the CHI cache till its destruction.\n\nHowever, **WARNING:** this flag is currently a bit dodgy, and CHI caches being kept alive\ntill global destruction **WILL** trigger a `SEGV`, and potentially leave your cache broken.\n\nYou can avoid this by manually destroying the cache with:\n\n    undef $cache\n\nPrior to global destruction.\n\n## `db_flags`\n\nFlags to pass to `OpenDB`/`LMDB_File-\u003eopen`.\n\nSee [`LMDB_File`'s constructor options](https://metacpan.org/pod/LMDB_File#LMDB_File) for details.\n\n    use LMDB_File qw( MDB_CREATE );\n\n    db_flags =\u003e MDB_CREATE # default\n\n## `tx_flags`\n\nFlags to pass to `LMDB::Env-\u003enew`\n\nSee [`LMDB::Env`'s constructor options](https://metacpan.org/pod/LMDB_File#LMDB::Env) for details.\n\nDefault is `0`\n\n    tx_flags =\u003e 0 # no flags\n\n## `put_flags`\n\nFlags to pass to `-\u003eput(k,v,WRITE_FLAGS)`.\n\nSee [LMDB\\_File-\u003eput options](https://metacpan.org/pod/LMDB_File#LMDB_File) for details.\n\n## `mapsize`\n\nPasses through to `LMDB::Env-\u003enew( mapsize =\u003e ... )`\n\nDefault value is taken from [\"cache\\_size\"](#cache_size) with some `m/k` math if its set.\n\n## `maxreaders`\n\nPasses through to `LMDB::Env-\u003enew( maxreaders =\u003e ... )`\n\n## `maxdbs`\n\nPasses through to `LMDB::Env-\u003enew( maxdbs =\u003e ... )`\n\nDefines how many CHI namespaces ( Databases ) a path can contain.\n\nDefault is 1024.\n\n## `mode`\n\nPasses through to `LMDB::Env-\u003enew( mode =\u003e ... )`\n\nDefines the permissions on created DB Objects.\n\nDefaults to `oct 600` == `-rw-------`\n\n## `flags`\n\nPasses through to `LMDB::Env-\u003enew( flags =\u003e ... )`\n\n# PERFORMANCE\n\nIf write performance is a little slow for you ( due to the defaults being a single\ntransaction per SET/GET operation, and transactions being flushed to disk when written ),\nthere are two ways you can make performance a little speedy.\n\n## Single Transaction Mode.\n\nIf you pass `single_txn =\u003e 1` the cache will be given a single transaction\nfor the life of its existence. However, pay attention to the warnings about cleaning\nup properly in [\"single\\_txn\"](#single_txn).\n\nAlso, this mode is less ideal if you want to have two processes sharing a cache,\nbecause the data won't be visible on the other one till it exits! ☺\n\n## `NOSYNC` Mode.\n\nYou can also tell LMDB **NOT** to call `sync` at the end of every transaction,\nand this will greatly improve write performance due to IO being greatly delayed.\n\nThis greatly weakens the databases consistency, but that seems like a respectable\ncompromise for a mere cache backend, where a missing record is a performance hit, not a loss of data.\n\n    use LMDB_File qw( MDB_NOSYNC MDB_NOMETASYNC );\n    ...\n    my $cache = CHI-\u003enew(\n      ...\n      flags =\u003e MDB_NOSYNC | MDB_NOMETASYNC\n    );\n\nThis for me cuts down an operation that takes 30 seconds worth of writes down to 6 ☺.\n\n# In Depth\n\nFor an in-depth comparison of the performance of various options,\nand how that compares to [`CHI::Driver::FastMmap`](https://metacpan.org/pod/CHI::Driver::FastMmap),\nsee [http://kentnl.github.io/CHI-Driver-LMDB](http://kentnl.github.io/CHI-Driver-LMDB)\n\n# AUTHOR\n\nKent Fredric \u003ckentnl@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2017 by Kent Fredric \u003ckentfredric@gmail.com\u003e.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentnl%2Fchi-driver-lmdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentnl%2Fchi-driver-lmdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentnl%2Fchi-driver-lmdb/lists"}