Are we being lazy with memoization?
May 10, 2021 · 5 min read · Sometimes we need to memoize/cache expensive operations. A typical case is to avoid multiple database calls. A common Ruby technique is to use the lazy evaluation operator ||= def customer @customer ||= Customer.find(@customer_id) end If @cu...
Join discussion