nyaruka / gocommon

Common utility library for the TextIt platform.
Other
7 stars 11 forks source link

Add rcache module #35

Closed nicpottier closed 4 years ago

nicpottier commented 4 years ago

Formalizes our pattern for redis caches with ~24 hour expirations.

We do this in various places manually (we have a marker version of this in mailroom that isn't for values, just presence of a key) but it is a confusing pattern so adding to gocommon for use in courier etc..

Concept is basically each group gets a day-specific hash of values with a 24 hour expiration. This decreases total storage size (fewer top level keys, no repeat of prefix, fewer keys to check for expiration) while still using native Redis expiration.

CC: @koallann

codecov[bot] commented 4 years ago

Codecov Report

Merging #35 into master will decrease coverage by 0.47%. The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
- Coverage   89.19%   88.71%   -0.48%     
==========================================
  Files          18       19       +1     
  Lines         620      647      +27     
==========================================
+ Hits          553      574      +21     
- Misses         42       45       +3     
- Partials       25       28       +3     
Impacted Files Coverage Δ
rcache/rcache.go 77.77% <77.77%> (ø)

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 475fff6...a98a1fd. Read the comment docs.