Skip to content

Conversation

@marisn
Copy link
Contributor

@marisn marisn commented Oct 3, 2025

As LMDB stores a binary blob, there are no CLI tools to explore database contents. These two utilities allow to look inside a LMDB cache by listing all keys stored in it and extracting data by key value.

Usage examples

Find out how many tiles are stored in the database:

$ mapcache_lmdb_list -d o2016/ -s
Total keys found: 1296

List all 1296 tile keys (be ware of printing keys for large databases!)

$ mapcache_lmdb_list -d o2016/
orto2016-L-{dim}-0-0-0.xxx
orto2016-L-{dim}-0-0-1.xxx
...

List all 1296 keys and additionally print tile timestamp and size. Size 4 indicates that it is a blank tile (just RGBA value).

$ mapcache_lmdb_list -d o2016/ -e
orto2016-L-{dim}-0-2-1.xxx,2025-09-02T13:41:35Z,4
orto2016-L-{dim}-0-2-2.xxx,2025-09-02T13:41:35Z,1727
...

Extract one tile to a file

$ mapcache_lmdb_get -d o2016/ -k orto2016-L-{dim}-0-2-1.xxx -o my_tile.png
Key found. Blank tile, color #ffffffff. Writing description to "my_tile.png"
Timestamp: Tue, 02 Sep 2025 13:41:35 GMT
$ mapcache_lmdb_get -d o2016/ -k orto2016-L-{dim}-0-2-2.xxx -o my_tile.png
Key found. Writing 1727 image bytes to "my_tile.png"
Timestamp: Tue, 02 Sep 2025 13:41:35 GMT

@marisn marisn marked this pull request as ready for review October 3, 2025 12:31
@jmckenna
Copy link
Member

jmckenna commented Oct 3, 2025

thanks @marisn !

@marisn
Copy link
Contributor Author

marisn commented Oct 5, 2025

What wasn't discussed if all functionality should be wrapped in a single utility or kept as two separate. Both are valid options. Yes, thinking is not my strong point.

@jmckenna
Copy link
Member

I personally prefer 2 separate utilities, as you have done.

@jmckenna jmckenna added this to the 1.16.0 milestone Dec 4, 2025
@marisn marisn marked this pull request as draft December 5, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants