kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
505 stars 41 forks source link

doesExist returns false after put with cache enabled #210

Closed KyleAMathews closed 1 year ago

KyleAMathews commented 1 year ago

I assumed that doesExist would work with in-flight puts but apparently not? It'd be convenient to support both in-flight + synced.

import * as lmdb from "lmdb";
let store = lmdb.open("cache", {
  name: "cache",
  cache: true,
});

async function main() {
  console.log(store.doesExist("x"));
  console.log(store.get("x"));
  store.put("x", Buffer.from(""));
  console.log(store.doesExist("x"));
  console.log(store.get("x"));
}

main();
kriszyp commented 1 year ago

Good catch, thanks for the report. Committed a fix, will publish soon.

BTW, congratulations on the Netlify deal! Really happy for you and the team!

KyleAMathews commented 1 year ago

Thanks!