Skip to content

Commit

Permalink
Allow forcing tree cache updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Jun 8, 2020
1 parent 8cbd4d7 commit 82c8938
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/alia/flow/object_trees.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ struct scoped_tree_cacher
scoped_tree_cacher(
tree_traversal<Object>& traversal,
tree_caching_data<Object>& data,
id_interface const& content_id)
id_interface const& content_id,
bool force_update)
{
begin(traversal, data, content_id);
begin(traversal, data, content_id, force_update);
}
~scoped_tree_cacher()
{
Expand All @@ -253,11 +254,12 @@ struct scoped_tree_cacher
begin(
tree_traversal<Object>& traversal,
tree_caching_data<Object>& data,
id_interface const& content_id)
id_interface const& content_id,
bool force_update)
{
traversal_ = &traversal;
data_ = &data;
content_traversal_required_ = false;
content_traversal_required_ = force_update;

// If the content ID changes, we know we have to refresh the contents.
if (!data.content_id.matches(content_id))
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/flow/object_trees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ TEST_CASE("object tree caching", "[flow][object_trees]")
auto& caching_data
= get_cached_data<tree_caching_data<test_object>>(ctx);
scoped_tree_cacher<test_object> cacher(
get<tree_traversal_tag>(ctx), caching_data, make_id(n & 12));
get<tree_traversal_tag>(ctx), caching_data, make_id(n & 12), false);
ALIA_EVENT_DEPENDENT_IF(cacher.content_traversal_required())
{
the_log << "traversing cached content; ";
Expand Down

0 comments on commit 82c8938

Please sign in to comment.