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

Allow expires in to be set dynamically #5

Merged
merged 1 commit into from Feb 28, 2019

Conversation

Projects
None yet
2 participants
@tldev
Copy link
Contributor

tldev commented Feb 28, 2019

Hey @dobs,

Thanks for this repo, we use it at my company quite extensively. One issue we're running into is the cache entries expiring all at once due to the entries being warmed all at once. This causes spikes in traffic that we'd like to smooth out.

Our goal is to introduce a bit of noise to the entries we are caching to allow for re-fetching to be smoothed out.

Example:

faraday.use :manual_cache,
            expires_in: ->(_) { 86400 +  rand(0..1440) }

Let me know if you'd like me to make any changes. Thanks.

@dobs

This comment has been minimized.

Copy link
Owner

dobs commented Feb 28, 2019

This looks great @tldev -- thanks for contributing! Merging in and bumping the version now, will push the new version to rubygems later today.

@dobs dobs merged commit 4ab7fad into dobs:master Feb 28, 2019

@dobs

This comment has been minimized.

Copy link
Owner

dobs commented Feb 28, 2019

Updated gem has been pushed as v0.4.0, thanks again for the contribution! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.