mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::db: Add column prefetch.
This commit is contained in:
parent
ca1ee19a47
commit
62426ab210
2 changed files with 16 additions and 0 deletions
|
@ -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 & = {});
|
||||
|
|
15
ircd/db.cc
15
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,
|
||||
|
|
Loading…
Reference in a new issue