How ActiveRecord Uses Caching To Avoid Unnecessary Trips To The Database

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 #database https://rubyonrails.ba/single/how-activerecord-uses-caching-to-avoid-unnecessary-trips-to-the-database

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles