chanzuckerberg / redis-memo

A Redis-based version addressable caching system. Memoize pure functions, aggregated database queries, and 3rd party API calls.
https://rubygems.org/gems/redis-memo
MIT License
33 stars 3 forks source link

[feature] Use railtie to load middleware #69

Closed donaldong closed 3 years ago

donaldong commented 3 years ago

This uses railties to load RedisMemo::Middleware. The implementation is identical to https://github.com/steveklabnik/request_store/blob/master/lib/request_store/railtie.rb.

If a project has both RedisMemo and RequestStore configured, RedisMemo and RequestStore middleware will be next to each other. Their relative ordering does not matter much.

Test Plan

codecov[bot] commented 3 years ago

Codecov Report

Merging #69 (7683985) into main (3ef1c93) will increase coverage by 0.01%. The diff coverage is 96.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
+ Coverage   97.42%   97.43%   +0.01%     
==========================================
  Files          34       36       +2     
  Lines        2252     2264      +12     
==========================================
+ Hits         2194     2206      +12     
  Misses         58       58              
Impacted Files Coverage Δ
lib/redis_memo/railtie.rb 80.00% <80.00%> (ø)
lib/redis_memo/memoize_query.rb 97.05% <97.01%> (-0.05%) :arrow_down:
lib/redis_memo.rb 98.07% <100.00%> (+0.03%) :arrow_up:
spec/railtie_spec.rb 100.00% <100.00%> (ø)
lib/redis_memo/middleware.rb 40.00% <0.00%> (+10.00%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3ef1c93...7683985. Read the comment docs.

donaldong commented 3 years ago

also configure the test env db

:mag_right: Click to see changes since last update.

donaldong commented 3 years ago

fixing spec

:mag_right: Click to see changes since last update.

donaldong commented 3 years ago

fixing spec

:mag_right: Click to see changes since last update.