title: How can I clear rails action cache? (Rails.cache.clear isn't working)
body: <h2>How can I clear rails action cache without restarting the server?</h2>
  <p>I have a script that updates the Postgres database with new data. I'd like to clear all cached pages after the script completes. but I can't seem to get this to take effect without completely restarting the Heroku server</p>
  <p>I have tried without success:</p>
  <ul>
  <li><code>Rails.cache.clear =&gt; [&quot;/app/tmp/cache/bootsnap-compile-cache&quot;, &quot;/app/tmp/cache/bootsnap-load-path-cache&quot;]</code></li>
  <li><code>rails tmp:cache:clear</code></li>
  <li><code>rails assets:clean</code></li>
  </ul>
  <p>config.cache_store is not set explicitly for production, (I've seen mixed information as to what cache is being used by default)</p>
  <p>I have ensured that there is no caching in the browser (by disabling caching in dev tools and bypassing the service worker)</p>
  <p>I'm using Heroku with ruby 2.5.3, rails 5.2.1.1, and actionpack-action_caching 1.2.0</p>
  <h4>How do I know it's not being cached at the database layer or with Fragment Caching?</h4>
  <p>I added logging to the action which only logs the first time a page is accessed after a restart</p>
  <p><strong>Update:</strong> I removed action caching and instead better optimized the SQL quarries by using eager loading.</p>
  <h2>Update 2 (writing in retrospect)</h2>
  <p>I didn't properly understand how Heroku's dyno's work.</p>
  <p>Heroku spines up new VM's (dynos) when using <a href="https://devcenter.heroku.com/articles/one-off-dynos#an-example-one-off-dyno" rel="nofollow noreferrer"><code>heroku run bash</code></a>, causing any cache clearing not to affect the webserver running on the existing dyno. To ssh into running dynos you'll want to use <a href="https://devcenter.heroku.com/articles/exec" rel="nofollow noreferrer"><code>heroku ps:exec</code></a></p>