Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve caching behavior of database integration #444

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ class LazyLoad final : public data_interfaces::IDataSystem {
std::function<
data_interfaces::IDataReader::CollectionResult<Item>()> const&
getter) const {
// Storing an expiry time so that the 'all' key and the individual
// item keys will expire at the same time.
// The 'all' key and the individual item keys should expire
// at exactly the same time, because there is no separate data item
// for 'all' - it exists only to rate limit the refresh of all items.
auto const updated_expiry = ExpiryTime();

// Refreshing 'all' for this item is always rate limited, even if
Expand All @@ -158,7 +159,7 @@ class LazyLoad final : public data_interfaces::IDataSystem {

for (auto item : *all_items) {
cache_.Upsert(item.first, std::move(item.second));
tracker_.Add(item.first, updated_expiry);
tracker_.Add(item_kind, item.first, updated_expiry);
}
} else {
status_manager_.SetState(
Expand Down
Loading