Skip to content

Conversation

Sherman-m
Copy link

adding ydb cache policy

@Sherman-m Sherman-m force-pushed the ydb_cache_component branch from 7914dd7 to 5d867bf Compare May 25, 2025 15:36

// clang-format off

/// @page Caching Component for Ydb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the extended documentation to scripts/docs/*/ydb_cache.md
Huge pages in C++ code are considered harmful for new code

///
/// @see @ref ydb_cache, @ref scripts/docs/en/userver/caches.md
template <typename YdbCachePolicy>
class YdbCache final
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

components::YdbCache -> ydb::CacheComponent
We don't use components:: namespace for new code, and duplicating "ydb" twice is also not the best naming

ydb_cache::detail::kDefaultChunkSize)} {
/* TODO
UINVARIANT(
!chunk_size_ || storages::ydb::Portal::IsSupportedByDriver(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reminder to clean all the commented code

config.Name() + "' cache");
}

const auto ydb_alias = config["ydbcomponent"].As<std::string>("");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only 1 ydb component, but it has multiple databases


// clang-format off

/// @page Caching Component for Ydb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the new documentation page to index.md as a sublist item to main YDB page

/// ----------
///
/// @htmlonly <div class="bottom-nav"> @endhtmlonly
/// ⇦ @ref scripts/docs/en/userver/cache_dumps.md | @ref scripts/docs/en/userver/lru_cache.md ⇨
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix according to the position in index.md relative to other pages.
Also fix the footers in the neighbouring pages to point to the new ydb cache page

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a functional test. It shouldn't use any fancy features. Have a small, but realistic table. Add a handler that returns data from the cache. Check that the cache works. Check that the cache can get stale relatively to the data in the table, then call await service_client.invalidate_caches(cache_names=...) to update the cache and verify it

The test will also serve as a proof-of-concept that you've really got a working YDB cache. test/cache.cpp does not provide that guarantee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants