How ActiveRecord Uses Caching To Avoid Unnecessary Trips To The Database
28-Jan-2021 2348
A general way to describe caching is storing the result of some code so that we can quickly retrieve it later. In some cases, this means storing a computed value to avoid needing to recompute it later. However, we can also cache data by simply keeping it in memory, without performing any computations, to avoid having to read from a hard drive or perform a network request.This latter form is particularly relevant for ActiveRecord, where the database often runs on a separate server. Thus, all requests incur network-traffic overhead, not to mention the load placed on the database server when the query is performed again.
How ActiveRecord Uses Caching To Avoid Unnecessary Trips To The Database #ruby #rubydeveloper #rubyonrails #ActiveRecord #Caching #Avoid #Unnecessary #Trips #Database #activerecord #database https://rubyonrails.ba/link/how-activerecord-uses-caching-to-avoid-unnecessary-trips-to-the-database