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

[feature] Use railtie to load middleware #69

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

donaldong
Copy link
Contributor

@donaldong donaldong commented Apr 24, 2021

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

  • added a test case to describe this behavior
  • ci

@donaldong donaldong changed the base branch from main to stacked_pr/base/donaldong/featur-06b6e74 April 24, 2021 16:35
donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 7097dbc to 2786d34 Compare April 24, 2021 16:35
@donaldong donaldong changed the base branch from stacked_pr/base/donaldong/featur-06b6e74 to main April 24, 2021 16:35
donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 2786d34 to 7a8cf42 Compare April 24, 2021 16:35
@codecov
Copy link

codecov bot commented Apr 24, 2021

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%) ⬇️
lib/redis_memo.rb 98.07% <100.00%> (+0.03%) ⬆️
spec/railtie_spec.rb 100.00% <100.00%> (ø)
lib/redis_memo/middleware.rb 40.00% <0.00%> (+10.00%) ⬆️

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 added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong
Copy link
Contributor Author

also configure the test env db

🔎 Click to see changes since last update.

donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 7a8cf42 to 16c0973 Compare April 24, 2021 16:41
donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong
Copy link
Contributor Author

fixing spec

🔎 Click to see changes since last update.

donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 16c0973 to 580c3a7 Compare April 24, 2021 20:46
donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong
Copy link
Contributor Author

fixing spec

🔎 Click to see changes since last update.

donaldong added a commit that referenced this pull request Apr 24, 2021
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 580c3a7 to 66243b2 Compare April 24, 2021 20:53
Pull Request Branch: donaldong/feature_use_railtie_to-1c53203
Pull Request Link: #69
@donaldong donaldong force-pushed the donaldong/feature_use_railtie_to-1c53203 branch from 66243b2 to 7683985 Compare April 27, 2021 17:37
@donaldong donaldong merged commit 34d64fd into main Apr 27, 2021
@donaldong donaldong deleted the donaldong/feature_use_railtie_to-1c53203 branch April 27, 2021 17:41
@donaldong donaldong mentioned this pull request Jun 3, 2021
donaldong added a commit that referenced this pull request Jun 3, 2021
### Breaking Changes
- Inline cache validation sample percentage (#78): `config.cache_validation_sampler` is replaced with `config.cache_validation_sample_percentage`
- Rename `RedisMemo.without_memo` -> `RedisMemo.without_memoization` (#85)

### Features
- Support more queries with range (>=, <= etc) (#63)
- Use railtie to load middleware (#69)
- Support Ruby 3.x (#83)
- Move lua to a separate file, run evalsha after script is already loaded (#84)

### Doc
- Update README (#73)
- Add options doc (#77)
- Add more rdocs for RedisMemo::Batch and RedisMemo::MemoizeMethod (#80)
- Add rdocs for RedisMemo::MemoizeQuery (#81)
- Add docs for RedisMemo::Memoizable and RedisMemo::Memoizable::Invalidation (#82)
- Add rdocs for cache select (#91)
- Check in wiki pages (#86)
- Check in an example config (#89)

### Refactor
- Fix rubocop lint errors (#79)
- Move redis-memo specific environment variables into DefaultOptions (#76)
- Move errors to a separate file (#72)
- Add RedisMemo::Util (#71)
- Define ThreadLocalVar (#70)
donaldong added a commit that referenced this pull request Jun 3, 2021
### Breaking Changes
- Inline cache validation sample percentage (#78): `config.cache_validation_sampler` is replaced with `config.cache_validation_sample_percentage`
- Rename `RedisMemo.without_memo` -> `RedisMemo.without_memoization` (#85)

### Features
- Support more queries with range (>=, <= etc) (#63)
- Use railtie to load middleware (#69)
- Support Ruby 3.x (#83)
- Move lua to a separate file, run evalsha after script is already loaded (#84)

### Doc
- Update README (#73)
- Add options doc (#77)
- Add more rdocs for RedisMemo::Batch and RedisMemo::MemoizeMethod (#80)
- Add rdocs for RedisMemo::MemoizeQuery (#81)
- Add docs for RedisMemo::Memoizable and RedisMemo::Memoizable::Invalidation (#82)
- Add rdocs for cache select (#91)
- Check in wiki pages (#86)
- Check in an example config (#89)

### Refactor
- Fix rubocop lint errors (#79)
- Move redis-memo specific environment variables into DefaultOptions (#76)
- Move errors to a separate file (#72)
- Add RedisMemo::Util (#71)
- Define ThreadLocalVar (#70)
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.

None yet

2 participants