0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-26 05:48:20 +02:00

ircd::db: Add column prefetch.

This commit is contained in:
Jason Volk 2018-09-01 04:38:30 -07:00
parent ca1ee19a47
commit 62426ab210
2 changed files with 16 additions and 0 deletions

View file

@ -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 & = {});

View file

@ -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,