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

Replaced CachedAt and TimeToLive fields with single Expiry field #13

Merged
merged 7 commits into from
Oct 28, 2019

Conversation

Turnerj
Copy link
Member

@Turnerj Turnerj commented Oct 28, 2019

The primary goal is to save allocations and serializer costs of storing two fields (16 bytes total) instead of a single field (8 bytes total). While these values are very small, being part of the CacheEntry type meant they were propagated everywhere and serializers needed to handle these values even if they rarely (if ever) dealt with anything but the expiry.

Rather than try and complicate the code by switching what type is being used where, it would instead do a slight change to make parts that needed CachedAt (primarily around dealing with the stale date) reverse calculate it from the expiry and CacheSettings.TimeToLive value. Even with that in mind, it shows a net improvement in allocations (though small) and even subtle improvements to performance.

Drops the CachedAt and TimeToLive fields in exchange for a single expiry field - this saves 8 bytes per cache entry and any additional serialization required.
@Turnerj Turnerj added the enhancement New feature or request label Oct 28, 2019
@Turnerj Turnerj merged commit d4135e3 into master Oct 28, 2019
@Turnerj Turnerj deleted the cachentry-expiry-field branch October 17, 2020 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant