Store keys in a 'minetest' hash instead of using the whole database
Also implements some suggestions from @xyzz