Skip to content

Conversation

@broosk1993
Copy link

This PR adds support for Solid Cache. It relies on the "unless_exist" flag to implement the locking mechanism. The flag was added recently: https://github.com/rails/solid_cache/pull/188/files.

The proper way to use this with Solid Cache is to create an initializer and put the following code in it:

require './lib/idempotent_request/policy'

Rails.application.config.middleware.use IdempotentRequest::Middleware,
                                        storage: IdempotentRequest::SolidCacheStorage.new(Rails.cache, expires_in: 1.day.from_now.to_f),
                                        policy: IdempotentRequest::Policy

The key difference here is using expires_in as opposed to expires_at.

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.

1 participant