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

Caching certificates on memory. #33

Merged
merged 3 commits into from
Apr 13, 2022
Merged

Conversation

socio-mehmet
Copy link
Contributor

The problem:
For every FirebaseIdToken::Signature.verify it initiates FirebaseIdToken::Certificates instance and on the initialize level it calls read_certificates method which retrieves certificate from Redis for each call. This is leading to unnecessary Redis call.

The problem:
I have refactored FirebaseIdToken::Signature.verify which utilize Thread variables to cache certificates and ttl. With this new setup, there will only one Redis call with the life of ttl. No extra JSON.parse and no extra certificate generation with OpenSSL::X509::Certificate.new

…hem inside thread variable. With this thread variable, we store certificate and tll on the memory and if expires at less than current time it invalidates thread variable and reloads it.
@socio-mehmet socio-mehmet changed the title Caching certs and til. Caching certificates. Jun 7, 2021
@socio-mehmet socio-mehmet changed the title Caching certificates. Caching certificates on memory. Jun 7, 2021
@fschuindt
Copy link
Owner

Thank you both @socio-mehmet and @metekabak. This is merged now and will be released on the next version, today still.

@fschuindt fschuindt merged commit 12f4394 into fschuindt:master Apr 13, 2022
fschuindt added a commit that referenced this pull request Aug 15, 2022
fschuindt added a commit that referenced this pull request Aug 15, 2022
fix: Multi thread caching by reverting PR #33
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.

3 participants