{"id":2139,"date":"2026-09-06T10:00:00","date_gmt":"2026-09-06T10:00:00","guid":{"rendered":"https:\/\/muzi.tw\/thinking\/object-cache-lies-tmp-en-us\/"},"modified":"2026-10-02T05:29:06","modified_gmt":"2026-10-02T05:29:06","slug":"object-cache-lies","status":"publish","type":"post","link":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/","title":{"rendered":"The database had the new value. The site was three minutes behind."},"content":{"rendered":"<p class=\"mz-nt-lead\">We had one setting to change and took the fastest route: write it straight into the database.<\/p>\n<p>The write succeeded. A SQL query showed the new value. The site was still reading the old one.<\/p>\n<h2>The symptoms sent us the wrong way<\/h2>\n<p>That setting decides which theme the site runs. With the old value, the new theme never loaded at all. No styles, no functions, and the front end fell back to the default look.<\/p>\n<p>That looks exactly like &#8220;the new theme has an error, so the system fell back to the default theme.&#8221; We did go down that path for a while, checking the syntax, the required files and the format of the theme declaration one by one. All fine.<\/p>\n<h2>How to tell them apart<\/h2>\n<p>Eventually we asked the system two different questions. Does this theme have any errors? Is it in the system&#8217;s list of themes?<\/p>\n<p>No errors, and it&#8217;s in the list, so it isn&#8217;t broken. The problem wasn&#8217;t the theme or the database. Something between the two was in the way.<\/p>\n<p>That something was the persistent object cache. When the site reads a setting it asks the cache first, and if the cache has a value it never goes to the database.<\/p>\n<h2>Two things<\/h2>\n<p>First, after any write that bypasses the application, clear the cache.<\/p>\n<p>Second, after clearing it, verify from a separate process. In the original process, the theme&#8217;s styles and functions had already loaded before the cache was cleared, so checking right there still comes back empty and you&#8217;ll think clearing did nothing. We fell into that one too.<\/p>\n<p>Writing to the database directly isn&#8217;t a mistake, and neither is taking a shortcut. That time we just forgot that by skipping the application, we&#8217;d also skipped the step where it clears the cache for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.<\/p>\n","protected":false},"author":1,"featured_media":1026,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[29],"tags":[],"class_list":["post-2139","post","type-post","status-publish","format-standard","has-post-thumbnail","category-web-notes-en-us"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The database had the new value. The site was three minutes behind. - Muzi Studio<\/title>\n<meta name=\"description\" content=\"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The database had the new value. The site was three minutes behind. - Muzi Studio\" \/>\n<meta property=\"og:description\" content=\"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/\" \/>\n<meta property=\"og:site_name\" content=\"Muzi Studio\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-06T10:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-02T05:29:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"1004\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"headline\":\"The database had the new value. The site was three minutes behind.\",\"datePublished\":\"2026-09-06T10:00:00+00:00\",\"dateModified\":\"2026-10-02T05:29:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/\"},\"wordCount\":321,\"publisher\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-object-cache-93933eaf.jpg\",\"articleSection\":[\"Web &amp; Technology\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/\",\"name\":\"The database had the new value. The site was three minutes behind. - Muzi Studio\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-object-cache-93933eaf.jpg\",\"datePublished\":\"2026-09-06T10:00:00+00:00\",\"dateModified\":\"2026-10-02T05:29:06+00:00\",\"description\":\"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#primaryimage\",\"url\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-object-cache-93933eaf.jpg\",\"contentUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-nt-object-cache-93933eaf.jpg\",\"width\":1800,\"height\":1004,\"caption\":\"A transparent lens clamped between two plates with blue and purple light glowing from underneath\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/thinking\\\/object-cache-lies\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The database had the new value. The site was three minutes behind.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\",\"name\":\"Muzi Studio\",\"description\":\"Muzi Studio\",\"publisher\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/muzi.tw\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#organization\",\"name\":\"Muzi Studio\",\"url\":\"https:\\\/\\\/muzi.tw\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-logo-512.png\",\"contentUrl\":\"https:\\\/\\\/muzi.tw\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/muzi-logo-512.png\",\"width\":512,\"height\":512,\"caption\":\"Muzi Studio\"},\"image\":{\"@id\":\"https:\\\/\\\/muzi.tw\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"email\":\"hello@muzi.tw\",\"description\":\"A brand, web and content studio in Taipei and Tokyo. We look at your growth goals and where you are today before deciding whether design needs to change.\",\"areaServed\":[\"Taiwan\",\"Japan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The database had the new value. The site was three minutes behind. - Muzi Studio","description":"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.","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:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/","og_locale":"en_US","og_type":"article","og_title":"The database had the new value. The site was three minutes behind. - Muzi Studio","og_description":"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.","og_url":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/","og_site_name":"Muzi Studio","article_published_time":"2026-09-06T10:00:00+00:00","article_modified_time":"2026-10-02T05:29:06+00:00","og_image":[{"width":1800,"height":1004,"url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","type":"image\/jpeg"}],"author":"admin","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#article","isPartOf":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/"},"author":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"headline":"The database had the new value. The site was three minutes behind.","datePublished":"2026-09-06T10:00:00+00:00","dateModified":"2026-10-02T05:29:06+00:00","mainEntityOfPage":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/"},"wordCount":321,"publisher":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"image":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#primaryimage"},"thumbnailUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","articleSection":["Web &amp; Technology"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/","url":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/","name":"The database had the new value. The site was three minutes behind. - Muzi Studio","isPartOf":{"@id":"https:\/\/muzi.tw\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#primaryimage"},"image":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#primaryimage"},"thumbnailUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","datePublished":"2026-09-06T10:00:00+00:00","dateModified":"2026-10-02T05:29:06+00:00","description":"Write straight to the database, bypassing the application, add a persistent cache on top, and the symptoms look like an entirely different failure.","breadcrumb":{"@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#primaryimage","url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","contentUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","width":1800,"height":1004,"caption":"A transparent lens clamped between two plates with blue and purple light glowing from underneath"},{"@type":"BreadcrumbList","@id":"https:\/\/muzi.tw\/en\/thinking\/object-cache-lies\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/muzi.tw\/en\/"},{"@type":"ListItem","position":2,"name":"The database had the new value. The site was three minutes behind."}]},{"@type":"WebSite","@id":"https:\/\/muzi.tw\/en\/#website","url":"https:\/\/muzi.tw\/en\/","name":"Muzi Studio","description":"Muzi Studio","publisher":{"@id":"https:\/\/muzi.tw\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/muzi.tw\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/muzi.tw\/en\/#organization","name":"Muzi Studio","url":"https:\/\/muzi.tw\/en\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/muzi.tw\/en\/#\/schema\/logo\/image\/","url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-logo-512.png","contentUrl":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-logo-512.png","width":512,"height":512,"caption":"Muzi Studio"},"image":{"@id":"https:\/\/muzi.tw\/en\/#\/schema\/logo\/image\/"},"email":"hello@muzi.tw","description":"A brand, web and content studio in Taipei and Tokyo. We look at your growth goals and where you are today before deciding whether design needs to change.","areaServed":["Taiwan","Japan"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/muzi.tw\/wp-content\/uploads\/2026\/09\/muzi-nt-object-cache-93933eaf.jpg","_links":{"self":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/comments?post=2139"}],"version-history":[{"count":3,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2139\/revisions"}],"predecessor-version":[{"id":2605,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/posts\/2139\/revisions\/2605"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/media\/1026"}],"wp:attachment":[{"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/media?parent=2139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/categories?post=2139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muzi.tw\/en\/wp-json\/wp\/v2\/tags?post=2139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}