diff --git a/include/ircd/db/column.h b/include/ircd/db/column.h index fb45b519d..73b82c780 100644 --- a/include/ircd/db/column.h +++ b/include/ircd/db/column.h @@ -40,6 +40,7 @@ namespace ircd::db // [GET] Tests if key exists bool has(column &, const string_view &key, const gopts & = {}); bool cached(column &, const string_view &key, const gopts & = {}); + void prefetch(column &, const string_view &key, const gopts & = {}); // [GET] Convenience functions to copy data into your buffer. string_view read(column &, const string_view &key, const mutable_buffer &, const gopts & = {}); diff --git a/ircd/db.cc b/ircd/db.cc index b1b041534..1ea8145d3 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -6988,6 +6988,21 @@ ircd::db::write(column &column, }; } +void +ircd::db::prefetch(column &column, + const string_view &key, + const gopts &gopts) +{ + if(exists(cache(column), key)) + return; + + request([column(column), key(std::string(key)), gopts] + () mutable + { + has(column, key, gopts); + }); +} + bool ircd::db::cached(column &column, const string_view &key,