api_cache
api_cache copied to clipboard
:period is confusing and limiting - here are some suggestions
First of all wanna thank you for this utility gem! Just wanna share some constructive suggestions.
I believe period: 0
should be the default. A very common case is to get
a result (here we wanna enforce a period), and to have an "update" get
for the result (where it's very important to have NO period as updates could happen at any time) As a result in my code I cannot use :period
at all, cause the :period
set when I "get" is gonna block me from making updates (which might happen soon after)
Hope that makes sense. In short I suggest:
- make
period: 0
the default - Add an option to ignore the period, perhaps
ignore_period: true
(this would allow one to "update" at anytime while still having a period for actual fetches)
EDIT: Actually I realized that I didn't have to wrap my update request at all - just needed to delete the local cache after the update, so the "option to ignore period" prob isn't as useful as I thought... still think period should default to 0 to reduce confusion tho
I agree that period: 0
should be the default, or at least directly documented.