refactor(cache): make the size provider a field, since that is what it is - #175
Closed
cosmin-staicu wants to merge 1 commit into
Closed
refactor(cache): make the size provider a field, since that is what it is#175cosmin-staicu wants to merge 1 commit into
cosmin-staicu wants to merge 1 commit into
Conversation
…t is SizeProvider was a get-only private property holding a value resolved once from the options. That is a readonly field wearing a property's clothes: no computation, no interception, nothing a property buys. It now sits with the other fields as _sizeProvider, which also keeps it out of the property block that the ordering rules group. The three other private properties in the library stay as they are: Database, ContinueLoop and ConnectionMultiplexer all compute on each read, which is what a private property is for. IMemoryCacheOptions.SizeProvider, the public option this reads from, is untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NsPw6MZHPGmpbo6WDuLzF1 Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
cosmin-staicu
requested review from
alinahornet,
cosminvlad,
litheon,
lucianaparaschivei and
razvalex
as code owners
September 10, 2026 14:54
There was a problem hiding this comment.
🟢 Approval recommended
The change is a behavior-preserving refactor with a straightforward substitution and no observable functional impact.
Pull request overview
This PR refactors MemoryCacheSetter to store the resolved ICacheEntrySizeProvider as a private readonly field instead of a get-only private property, aligning the implementation with its actual behavior (stateful, resolved once) and avoiding unnecessary “property” semantics.
Changes:
- Replace
private ICacheEntrySizeProvider SizeProvider { get; } = ...withprivate readonly ICacheEntrySizeProvider _sizeProvider = .... - Update the
SetSize(...)call site to use_sizeProvider.
File summaries
| File | Description |
|---|---|
| src/UiPath.Caching/MemoryCacheSetter.cs | Convert size-provider from private get-only property to private readonly field and update usage accordingly. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



MemoryCacheSetter.SizeProviderwas a get-only private property holding a value resolved once from the options:No computation, no interception, nothing a property buys over a field. It is now
_sizeProvider, declared with the other fields — which also keeps it out of the property block that the ordering rules group together.Came out of counting property accessibilities across
srcwhile sizing up the StyleCop ordering rules: 398 properties, of which exactly four are private. The other three earn it —RedisStreamHealthMaintainer.Database,RedisStreamSubjectWriter.ContinueLoopandRedisConnector.ConnectionMultiplexerall compute on every read, which is what a private property is for. This was the only one holding state.IMemoryCacheOptions.SizeProvider, the public option it reads from, is untouched.Build clean, full suite green: 1704 on net10, 1683 on net8.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NsPw6MZHPGmpbo6WDuLzF1