{"id":4875,"date":"2020-11-04T11:28:07","date_gmt":"2020-11-04T17:28:07","guid":{"rendered":"https:\/\/micronics.mx\/?p=4875"},"modified":"2020-11-19T16:02:40","modified_gmt":"2020-11-19T22:02:40","slug":"como-optimizar-la-cache-web","status":"publish","type":"post","link":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/","title":{"rendered":"How to optimize the web cache?"},"content":{"rendered":"<h1>How to optimize the web cache?<\/h1>\n<p>Web cache is a critical technology for optimizing performance on today&#039;s websites. Like any type of cache, its function is to store information temporarily to speed up a process, in this case being the loading of <a href=\"https:\/\/micronics.mx\/en\/web-page\/\">websites<\/a> along with its elements. Similarly, this also reduces the computational load on the servers.<\/p>\n<p>The web cache has become practically essential for a good browsing experience, since each time the sites are getting bigger and heavier. Thanks to this technology, load times can be imperceptible for users, in addition to reducing the consumption of their mobile data.<\/p>\n<p>In a way, this action of using temporary information instead of the most recent one (sent again by the server) can cause problems. Because it is composed of static files (such as scripts, style sheets and images), it may be that when making changes to any of these resources, these may not be sent to the client in their most recent form, but instead keep the old information . Because of this, something on the site may stop working or may simply not reflect the latest changes.<\/p>\n<p>There are a number of ways to solve these problems and continue to take full advantage of this technology. We will talk about some techniques in this article so if you are a programmer, keep reading.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Techniques for optimizing the web cache<\/strong><\/h2>\n<p>The following are some techniques of <a href=\"https:\/\/support.stackpath.com\/hc\/en-us\/articles\/360001224166-Cache-Busting-Explained\"><em>Cache Busting<\/em><\/a>, which can be implemented quickly and safely.<\/p>\n<h3><strong>Modify file name<\/strong><\/h3>\n<p>It simply consists of modifying the file name, preferably as a version control. After changing it, the browser cannot determine that it is cached, so it is forced to load it from the server. For example:<\/p>\n<p><\/p>\n<p><\/p>\n<p>It must be taken into account that the file with that name must exist, in case of not resorting to the technique of modifying .htaccess, which we will not cover in this article. Renaming can be done automatically with a JS or CSS compiler, avoiding manual work.<\/p>\n<h3><strong>Modify file directory<\/strong><\/h3>\n<p>It consists of modifying the file directory, preferably as a version control. Being a different URL, the browser will not use what it has in cache. For example:<\/p>\n<p><\/p>\n<p><\/p>\n<p>Keep in mind that the file has to exist in the specified directory for it to work.<\/p>\n<h3><strong>Query strings<\/strong><\/h3>\n<p>It consists of adding a <em>query string <\/em>to the file&#039;s URL, causing the browser to interpret it as a completely new resource. It is one of the simplest methods and used by CDNs.<\/p>\n<p><\/p>\n<p><\/p>\n<p>Do not forget to change the version every time it is necessary or, failing that, assign a random value or even a timestamp.<\/p>\n<p>An example to generate the version dynamically, through pure PHP would be:<\/p>\n<p>&lt; link rel=\u201dstylesheet\u201d href=\u201d\/css\/style.css?version= \u201d\/&gt;<\/p>\n<p>Although it would be better if we could take advantage of the benefits of the cache and forget them at your convenience. For this, you can rely on the following example in PHP:<\/p>\n<p>&lt; link rel=\u201dstylesheet\u201d href=\u201d\/css\/style.css?version= \u201d\/&gt;<\/p>\n<p>&lt;script src=\u201djs\/miScriptImportante.js?version=&lt;?php echo filemtime(\u201cjs\/ miScriptImportante.js\u201d)\u00a0 ?&gt;\u201d&gt;&lt;\/script&gt;<\/p>\n<p>Note that the important thing is to use the function filemtime (&quot;fileAddress&quot;), to obtain the date of the last modification of the file. This way we can ensure that the cache is ignored only when a file has changed. Of course, you have to make sure that they are worthwhile changes, since any small change would cause the most recent file to be sent.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>conclusion<\/strong><\/h2>\n<p>While Web Cache is a technology capable of dramatically reducing site loading time, it can create some headaches by not reflecting major resource changes. For this reason, it is important to take into account the techniques to ignore it when necessary.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>How to optimize the web cache? Web cache is a critical technology for optimizing performance on today&#039;s websites. Like any type of cache, its function is to store information temporarily to speed up a process, in this case being the loading of web pages together with their elements. Equally [\u2026]<\/p>","protected":false},"author":5,"featured_media":4876,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[167],"tags":[152,141],"class_list":["post-4875","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desarrollo-de-software","tag-desarrollo","tag-optimizacion"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX<\/title>\n<meta name=\"description\" content=\"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX\" \/>\n<meta property=\"og:description\" content=\"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"Micronics MX\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MicronicsMX\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-04T17:28:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-19T22:02:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Juan Manuel Salinas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@MicronicsMX\" \/>\n<meta name=\"twitter:site\" content=\"@MicronicsMX\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Juan Manuel Salinas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\"},\"author\":{\"name\":\"Juan Manuel Salinas\",\"@id\":\"https:\/\/micronics.mx\/#\/schema\/person\/ea2b397eb573cf9bd9b4f3075049a3b6\"},\"headline\":\"\u00bfC\u00f3mo optimizar la cach\u00e9 web?\",\"datePublished\":\"2020-11-04T17:28:07+00:00\",\"dateModified\":\"2020-11-19T22:02:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\"},\"wordCount\":795,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/micronics.mx\/#organization\"},\"image\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png\",\"keywords\":[\"Desarrollo\",\"Optimizaci\u00f3n\"],\"articleSection\":[\"Desarrollo de Software\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\",\"url\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\",\"name\":\"\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX\",\"isPartOf\":{\"@id\":\"https:\/\/micronics.mx\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png\",\"datePublished\":\"2020-11-04T17:28:07+00:00\",\"dateModified\":\"2020-11-19T22:02:40+00:00\",\"description\":\"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.\",\"breadcrumb\":{\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage\",\"url\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png\",\"contentUrl\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png\",\"width\":1920,\"height\":1280,\"caption\":\"la cache web\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/micronics.mx\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u00bfC\u00f3mo optimizar la cach\u00e9 web?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/micronics.mx\/#website\",\"url\":\"https:\/\/micronics.mx\/\",\"name\":\"Micronics MX\",\"description\":\"Software Solutions\",\"publisher\":{\"@id\":\"https:\/\/micronics.mx\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/micronics.mx\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/micronics.mx\/#organization\",\"name\":\"Micronics MX\",\"url\":\"https:\/\/micronics.mx\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/micronics.mx\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2018\/08\/logo.png\",\"contentUrl\":\"https:\/\/micronics.mx\/wp-content\/uploads\/2018\/08\/logo.png\",\"width\":450,\"height\":80,\"caption\":\"Micronics MX\"},\"image\":{\"@id\":\"https:\/\/micronics.mx\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/MicronicsMX\",\"https:\/\/x.com\/MicronicsMX\",\"https:\/\/www.instagram.com\/micronicsmx\/\",\"https:\/\/www.linkedin.com\/company\/micronicsmx\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/micronics.mx\/#\/schema\/person\/ea2b397eb573cf9bd9b4f3075049a3b6\",\"name\":\"Juan Manuel Salinas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/micronics.mx\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/micronics.mx\/wp-content\/litespeed\/avatar\/1dc555091ce950152ef5495b63da392a.jpg?ver=1775872646\",\"contentUrl\":\"https:\/\/micronics.mx\/wp-content\/litespeed\/avatar\/1dc555091ce950152ef5495b63da392a.jpg?ver=1775872646\",\"caption\":\"Juan Manuel Salinas\"},\"sameAs\":[\"https:\/\/micronics.mx\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX","description":"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.","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:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/","og_locale":"en_US","og_type":"article","og_title":"\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX","og_description":"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.","og_url":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/","og_site_name":"Micronics MX","article_publisher":"https:\/\/www.facebook.com\/MicronicsMX","article_published_time":"2020-11-04T17:28:07+00:00","article_modified_time":"2020-11-19T22:02:40+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png","type":"image\/png"}],"author":"Juan Manuel Salinas","twitter_card":"summary_large_image","twitter_creator":"@MicronicsMX","twitter_site":"@MicronicsMX","twitter_misc":{"Written by":"Juan Manuel Salinas","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#article","isPartOf":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/"},"author":{"name":"Juan Manuel Salinas","@id":"https:\/\/micronics.mx\/#\/schema\/person\/ea2b397eb573cf9bd9b4f3075049a3b6"},"headline":"\u00bfC\u00f3mo optimizar la cach\u00e9 web?","datePublished":"2020-11-04T17:28:07+00:00","dateModified":"2020-11-19T22:02:40+00:00","mainEntityOfPage":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/"},"wordCount":795,"commentCount":0,"publisher":{"@id":"https:\/\/micronics.mx\/#organization"},"image":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png","keywords":["Desarrollo","Optimizaci\u00f3n"],"articleSection":["Desarrollo de Software"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/","url":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/","name":"\u00bfC\u00f3mo optimizar la cach\u00e9 web? - Micronics MX","isPartOf":{"@id":"https:\/\/micronics.mx\/#website"},"primaryImageOfPage":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage"},"image":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png","datePublished":"2020-11-04T17:28:07+00:00","dateModified":"2020-11-19T22:02:40+00:00","description":"La cach\u00e9 web se ha vuelto pr\u00e1cticamente indispensable para una buena experiencia al navegar, aqui te presentamos algunos tips para mejorarlo.","breadcrumb":{"@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#primaryimage","url":"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png","contentUrl":"https:\/\/micronics.mx\/wp-content\/uploads\/2020\/11\/lacacheweb.png","width":1920,"height":1280,"caption":"la cache web"},{"@type":"BreadcrumbList","@id":"https:\/\/micronics.mx\/en\/how-to-optimize-web-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/micronics.mx\/"},{"@type":"ListItem","position":2,"name":"\u00bfC\u00f3mo optimizar la cach\u00e9 web?"}]},{"@type":"WebSite","@id":"https:\/\/micronics.mx\/#website","url":"https:\/\/micronics.mx\/","name":"Micronics MX","description":"Software Solutions","publisher":{"@id":"https:\/\/micronics.mx\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/micronics.mx\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/micronics.mx\/#organization","name":"Micronics MX","url":"https:\/\/micronics.mx\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/micronics.mx\/#\/schema\/logo\/image\/","url":"https:\/\/micronics.mx\/wp-content\/uploads\/2018\/08\/logo.png","contentUrl":"https:\/\/micronics.mx\/wp-content\/uploads\/2018\/08\/logo.png","width":450,"height":80,"caption":"Micronics MX"},"image":{"@id":"https:\/\/micronics.mx\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/MicronicsMX","https:\/\/x.com\/MicronicsMX","https:\/\/www.instagram.com\/micronicsmx\/","https:\/\/www.linkedin.com\/company\/micronicsmx\/"]},{"@type":"Person","@id":"https:\/\/micronics.mx\/#\/schema\/person\/ea2b397eb573cf9bd9b4f3075049a3b6","name":"Juan Manuel Salinas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/micronics.mx\/#\/schema\/person\/image\/","url":"https:\/\/micronics.mx\/wp-content\/litespeed\/avatar\/1dc555091ce950152ef5495b63da392a.jpg?ver=1775872646","contentUrl":"https:\/\/micronics.mx\/wp-content\/litespeed\/avatar\/1dc555091ce950152ef5495b63da392a.jpg?ver=1775872646","caption":"Juan Manuel Salinas"},"sameAs":["https:\/\/micronics.mx"]}]}},"_links":{"self":[{"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/posts\/4875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/comments?post=4875"}],"version-history":[{"count":0,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/posts\/4875\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/media\/4876"}],"wp:attachment":[{"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/media?parent=4875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/categories?post=4875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/micronics.mx\/en\/wp-json\/wp\/v2\/tags?post=4875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}