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

[fix] Fall back to uncached flow while extracting arel dependencies if active record queries are disabled #54

Closed katyho closed 3 years ago

katyho commented 3 years ago

Summary

If the kill switch is on to disable all cached select queries on redis-memo, then memoize_method is never called for connection.exec_query, and therefore :dependency_of is never dynamically defined. This falls back to the uncached method in case :dependency_of is not defined.

Test Plan

codecov[bot] commented 3 years ago

Codecov Report

Merging #54 (b6bc8dc) into main (4b2734a) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
+ Coverage   97.30%   97.31%   +0.01%     
==========================================
  Files          34       34              
  Lines        2115     2125      +10     
==========================================
+ Hits         2058     2068      +10     
  Misses         57       57              
Impacted Files Coverage Δ
lib/redis_memo/memoizable/dependency.rb 100.00% <100.00%> (ø)
spec/memoizable/dependency_spec.rb 100.00% <100.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 4b2734a...b6bc8dc. Read the comment docs.