mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 19:58:53 +02: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
|
// [GET] Tests if key exists
|
||||||
bool has(column &, const string_view &key, const gopts & = {});
|
bool has(column &, const string_view &key, const gopts & = {});
|
||||||
bool cached(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.
|
// [GET] Convenience functions to copy data into your buffer.
|
||||||
string_view read(column &, const string_view &key, const mutable_buffer &, const gopts & = {});
|
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
|
bool
|
||||||
ircd::db::cached(column &column,
|
ircd::db::cached(column &column,
|
||||||
const string_view &key,
|
const string_view &key,
|
||||||
|
|
Loading…
Reference in a new issue