{"id":19047,"date":"2017-11-02T12:15:56","date_gmt":"2017-11-02T10:15:56","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=19047"},"modified":"2017-11-01T10:27:29","modified_gmt":"2017-11-01T08:27:29","slug":"overview-caching-methods","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/","title":{"rendered":"An Overview of Caching Methods"},"content":{"rendered":"<p>Caching is a way to store and reuse the same data multiple times. By <em>data<\/em>, I mean anything like images, CSS files, JSON, etc. Caching will help you serve more requests per second and save on precious resources like network bandwidth and CPU load.<\/p>\n<p>What are some of the benefits and challenges that come with caching? What are the most important things you should know about every caching layer? In this post, I will do my best to answer these questions for you!<\/p>\n<h2>Caching Challenges<\/h2>\n<p>Caching comes with its own set of challenges you have to deal with. For example, what strategy are you going to use to decide when the cached data is stale? There are two main strategies:<\/p>\n<ul>\n<li>Expire a cached entry after a certain amount of time has passed.<\/li>\n<li>Expire a cached entry after the original resource has changed.<\/li>\n<\/ul>\n<p>The second option can be implemented by some event that changes the data and then triggers the cache refresh. Another way to implement this is by doing what Rails does by default, and that\u2019s to <a href=\"http:\/\/guides.rubyonrails.org\/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark\">fingerprint<\/a> (using a cryptographic hash) the file content.<\/p>\n<p>It looks like this:<\/p>\n<pre class=\"brush:php\">application-58d13b8475db67dfa81ae346b0ae67e9.css<\/pre>\n<p>When the file changes, the fingerprint also changes with it, which will trigger the browser to request what looks like a new file.<\/p>\n<p>Now that you are familiar with the main challenge imposed by caching, let\u2019s review some of the most common caching methods, including:<\/p>\n<ul>\n<li>Browser caching<\/li>\n<li>Key-value caching<\/li>\n<li>Application caching<\/li>\n<\/ul>\n<h2>Browser Caching<\/h2>\n<p>Browser caching is probably the most common type of caching that you will find in the wild. It\u2019s a collaboration between the browser and the web server, used to speed up the loading time of repeated visits to the same site.<\/p>\n<blockquote><p>Keep in mind that browser caching is an extensive topic, spanning multiple specification documents (<a href=\"https:\/\/tools.ietf.org\/html\/rfc7234\">rfc7234<\/a>, <a href=\"https:\/\/tools.ietf.org\/html\/rfc7232\">rfc7232<\/a>), so I will not cover every detail here.<\/p><\/blockquote>\n<p>Let me explain how browser caching works: When you load a site for the first time, your cache for that site is empty, so you have to request every resource (CSS, JS, images, etc.). Then, when you reload that page, a few things can happen in terms of caching:<\/p>\n<ul>\n<li>If the <code>Expires<\/code> header is set to a date in the future, the resource will be loaded from the cache and no server request will be made.<\/li>\n<li>If there is no <code>Expires<\/code> header or if it has a date in the past, the resource is requested again. The browser will send any other caching headers back with the request (like <code>If-None-Match<\/code> and <code>If-Modified-Since<\/code>).<\/li>\n<\/ul>\n<p>Then if the server determines (using one of these caching headers) that the resource hasn\u2019t changed, it will return a response with HTTP code 304 and no data. This saves the server some work and some bandwidth. When a browser receives the 304 \u2018Not modified\u2019 code, it will load the resource from the cache.<\/p>\n<h3>Browser caching in action<\/h3>\n<p>Let\u2019s analyze some example interactions using Chrome\u2019s network panel (you can open it using F12 &amp; clicking on \u2018Network\u2019). If you want to follow along make sure to clear your browser\u2019s cache first!<\/p>\n<p>Here is the initial request for <code>jquery.min.js<\/code>:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Initial-request.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-19053\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Initial-request.png\" alt=\"\" width=\"658\" height=\"331\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Initial-request.png 658w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Initial-request-300x151.png 300w\" sizes=\"(max-width: 658px) 100vw, 658px\" \/><\/a><\/p>\n<p>Since this is the first request for this file, we get a 200 OK response with the file contents.<\/p>\n<p>Notice the <code>Expires<\/code> header, which tells the browser that it doesn\u2019t need to request this file again until August, 8 2017. In this response, we can see another two caching-related headers: <code>Last-modified<\/code> and <code>Cache-Control<\/code>.<\/p>\n<blockquote><p><a href=\"https:\/\/developers.google.com\/speed\/docs\/insights\/LeverageBrowserCaching\">Google recommends<\/a> that you set your Expires header to at least one week in the future with a maximum of one year.<\/p><\/blockquote>\n<p>Now let\u2019s reload this page by pressing F5 and see what happens\u2026<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Reloading-image.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-19054\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Reloading-image.png\" alt=\"\" width=\"656\" height=\"207\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Reloading-image.png 656w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Reloading-image-300x95.png 300w\" sizes=\"(max-width: 656px) 100vw, 656px\" \/><\/a><\/p>\n<p>There are a couple of things going on here. To start with, we didn\u2019t expect the browser to request this resource again, since the <code>Expires<\/code> date is set in the future.<\/p>\n<p>Also we are getting a 304 code, because of the <code>If-Modified-Since<\/code> header that our browser sent with the request. So why didn\u2019t we get the expected behavior? Is the <code>Expires<\/code> header useless?<\/p>\n<p>Well, the thing is that most browsers will \u201cre-validate\u201d all possible resources when you press F5. This probably happens because, when you press F5, you are looking for the page to update, so it wouldn\u2019t make sense to reload everything from the cache.<\/p>\n<p>But let\u2019s see what happens if you use a bookmark or type the URL and press \u2018Enter\u2019 (tip: if you press F6, Chrome will focus the address bar without deleting the current URL).<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Using-a-bookmark.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-19055\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Using-a-bookmark.png\" alt=\"\" width=\"665\" height=\"116\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Using-a-bookmark.png 665w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Using-a-bookmark-300x52.png 300w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/a><\/p>\n<p>This time, you can see that Chrome says <code>200 (from cache)<\/code> in the response code of the network panel. This means that the <code>Expires<\/code> headers is doing its job!<\/p>\n<h2>The Etag Caching Header<\/h2>\n<p>We have already discussed the <code>Expires<\/code> header and the time-stamp-based validation (<code>If-modified-since<\/code>) header. But what we haven\u2019t covered is the <code>Etag<\/code> header. This serves the same purpose as the <code>If-modified-since<\/code> header, but instead of a time-stamp, it uses a hash-based approach.<\/p>\n<p>Here is an example so you can see what I mean:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Hash-based-approach.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-19056\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Hash-based-approach.png\" alt=\"\" width=\"554\" height=\"417\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Hash-based-approach.png 554w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/11\/Hash-based-approach-300x226.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/a><\/p>\n<p>The <code>Etag<\/code> header is formed using multiple data points. For example, in the Apache web server, the default <code>Etag<\/code> is constructed from:<\/p>\n<ul>\n<li>The file size<\/li>\n<li>The i-node number<\/li>\n<li>The last time the file was modified<\/li>\n<\/ul>\n<p>An i-node represents a file or directory in an Unix file system. This solves the expiration problem because whenever one of these parameters changes, the <code>Etag<\/code> hash will not match and the resource will be considered stale.<\/p>\n<p>For more details on the <code>Etag<\/code> header, <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTP_ETag#Typical_usage\">check out this Wikipedia article<\/a>.<\/p>\n<h2>Application-Level Caching<\/h2>\n<p>Let\u2019s explore another caching type: application-level caching, also known as <em>memoization<\/em>. This type of caching is useful when your program uses a method that is very slow, like reading a file and extracting some data from it or requesting data from an API.<\/p>\n<p>If we are going to use the data returned by this slow method multiple times, it doesn\u2019t make sense to have to request it from the original source every single time. One solution is to store the results of this slow method in an instance variable, then return these stored results on subsequent calls to this method.<\/p>\n<p>Let\u2019s take a look at a code example:<\/p>\n<pre class=\"brush:php\">def slow_method\r\n  @results = @results || get_data_from_api\r\nend\r\n\r\ndef get_data_from_api\r\n  sleep(3)\r\n  345\r\nend\r\n\r\np slow_method\r\np slow_method\r\np slow_method<\/pre>\n<p>If you run this code, you will notice that it takes about three seconds (which simulates the slow method) to print the method\u2019s result for the first time. But all the following calls to <code>slow_method<\/code> are going to be very fast, because there is no work to do.<\/p>\n<p>This feat is accomplished by this code:<\/p>\n<pre class=\"brush:php\">@results = @results || get_data_from_api<\/pre>\n<p>What this is saying is:<\/p>\n<blockquote><p>\u201cIf <code>@results<\/code> already exists, then keep it the way it is and return the stored result. If it doesn\u2019t exist, then make the slow API call to get the data we need and store it on <code>@results<\/code>.\u201d<\/p><\/blockquote>\n<p>A shortcut that is often seen in Ruby code is this:<\/p>\n<pre class=\"brush:php\">@results ||= get_data_from_api<\/pre>\n<p>Don\u2019t let the weird <code>||=<\/code> symbol confuse you; this code does the same as the last example.<\/p>\n<blockquote><p>Actually, <code>x ||= y<\/code> means exactly <code>x || (x = y)<\/code>, but that\u2019s just a small detail.<\/p><\/blockquote>\n<p>One of the potential downsides of memoization is that you will lose your cached data whenever you restart your application. And if you are using multiple applications\u2019 servers, you won\u2019t be able to share this cached data.<\/p>\n<h2>Key-Value Data Caching<\/h2>\n<p>On the last section, you learned how you can use memoization to temporarily store the results of a slow method. You can take this a step further with dedicated \u2018key-value\u2019 databases like memcache or Redis.<\/p>\n<p>One benefit of using something like <a href=\"https:\/\/redis.io\/\">Redis<\/a> is that your data will be able to persist through user requests and application reboots. The main downside is that you have to introduce another dependency to your application and another thing to keep an eye on.<\/p>\n<p>It\u2019s really easy to use Redis in your Ruby applications; all you need to do is install the server and its corresponding Ruby gem.<\/p>\n<blockquote><p>Redis versus memcache: Both can be used for caching, but Redis offers many more features, like being able to persist data to disk. Here is a <a href=\"http:\/\/stackoverflow.com\/a\/11257333\/1333436\">Stack Overflow<\/a> answer if you want to learn more.<\/p><\/blockquote>\n<p>Let\u2019s take a look at a Redis code example:<\/p>\n<pre class=\"brush:php\">require 'redis'\r\n\r\nredis = Redis.new(host: \"127.0.0.1\", port: 6380, db: 15)\r\nredis.set(\"user:1:last-login\", Time.now)\r\n# =&gt; \"OK\"\r\n\r\nredis.get(\"user:1:last-login\")\r\n# =&gt; \"2017-08-15 05:19:10 +0200\"<\/pre>\n<p>You can work with Redis with just two methods: <code>get<\/code> &amp; <code>set<\/code>. You can think of this as a remote hash table. In addition to caching, Redis is also very convenient for things like counters or some other kind of shared temporary data (like user sessions).<\/p>\n<h2>Summary<\/h2>\n<p>Now you should have a better understanding of the different types of caching available to you.<\/p>\n<p>But which ones should you use? Well, for starters, browser caching is a good baseline and it doesn\u2019t require you to write any extra code. A properly configured web server should take care of this.<\/p>\n<p>From there, you should identify what some of the \u201chot spots\u201d are for your application using profiling tools (like <code>rack-mini-profiler<\/code>) and implement another caching layer if it helps make your app faster without major downsides.<\/p>\n<p>If you enjoyed this article, don\u2019t forget to share it on your favorite social networks and to subscribe to our newsletter!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Web Code Geeks with permission by Jesus Castello, partner at our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\" target=\"_blank\" rel=\"noopener\">WCG program<\/a>. See the original article here: <a href=\"https:\/\/blog.codeship.com\/an-overview-of-caching-methods\/\" target=\"_blank\" rel=\"noopener\">An Overview of Caching Methods<\/a><\/p>\n<p>Opinions expressed by Web Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve more requests per second and save on precious resources like network bandwidth and CPU load. What are some of the benefits and challenges that come with &hellip;<\/p>\n","protected":false},"author":163,"featured_media":927,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-19047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>An Overview of Caching Methods - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"An Overview of Caching Methods - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-02T10:15:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jesus Castello\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jesus Castello\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\"},\"author\":{\"name\":\"Jesus Castello\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/2b499a1af8a7accd7f41642ef3c326ae\"},\"headline\":\"An Overview of Caching Methods\",\"datePublished\":\"2017-11-02T10:15:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\"},\"wordCount\":1527,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg\",\"articleSection\":[\"Web Dev\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\",\"name\":\"An Overview of Caching Methods - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg\",\"datePublished\":\"2017-11-02T10:15:56+00:00\",\"description\":\"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Dev\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/web-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"An Overview of Caching Methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/2b499a1af8a7accd7f41642ef3c326ae\",\"name\":\"Jesus Castello\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c133eea980270adf81cbc909efe23a5b5cf48156c9251427abde79a781e9ceec?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c133eea980270adf81cbc909efe23a5b5cf48156c9251427abde79a781e9ceec?s=96&d=mm&r=g\",\"caption\":\"Jesus Castello\"},\"description\":\"Jesus is a Ruby developer who likes to help other developers improve their Ruby skills &amp; fill-in the gaps in their education.\",\"sameAs\":[\"http:\/\/www.linkedin.com\/pub\/jesus-castello\/31\/333\/57\/en\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/jesus-castello\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"An Overview of Caching Methods - Web Code Geeks - 2026","description":"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/","og_locale":"en_US","og_type":"article","og_title":"An Overview of Caching Methods - Web Code Geeks - 2026","og_description":"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve","og_url":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-11-02T10:15:56+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg","type":"image\/jpeg"}],"author":"Jesus Castello","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Jesus Castello","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/"},"author":{"name":"Jesus Castello","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/2b499a1af8a7accd7f41642ef3c326ae"},"headline":"An Overview of Caching Methods","datePublished":"2017-11-02T10:15:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/"},"wordCount":1527,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg","articleSection":["Web Dev"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/","url":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/","name":"An Overview of Caching Methods - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg","datePublished":"2017-11-02T10:15:56+00:00","description":"Caching is a way to store and reuse the same data multiple times. By data, I mean anything like images, CSS files, JSON, etc. Caching will help you serve","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/web-dev-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/web-development\/overview-caching-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Dev","item":"https:\/\/www.webcodegeeks.com\/category\/web-development\/"},{"@type":"ListItem","position":3,"name":"An Overview of Caching Methods"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/2b499a1af8a7accd7f41642ef3c326ae","name":"Jesus Castello","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c133eea980270adf81cbc909efe23a5b5cf48156c9251427abde79a781e9ceec?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c133eea980270adf81cbc909efe23a5b5cf48156c9251427abde79a781e9ceec?s=96&d=mm&r=g","caption":"Jesus Castello"},"description":"Jesus is a Ruby developer who likes to help other developers improve their Ruby skills &amp; fill-in the gaps in their education.","sameAs":["http:\/\/www.linkedin.com\/pub\/jesus-castello\/31\/333\/57\/en"],"url":"https:\/\/www.webcodegeeks.com\/author\/jesus-castello\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/163"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=19047"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19047\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/927"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=19047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=19047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=19047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}