<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to clear all cache without restarting the cluster? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24341#M16910</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;%scala
def clearAllCaching(tableName: Option[String] = None): Unit = {
tableName.map { path =&amp;gt;
com.databricks.sql.transaction.tahoe.DeltaValidation.invalidateCache(spark, path)
}
spark.conf.set("com.databricks.sql.io.caching.bucketedRead.enabled", "false")
spark.conf.set("spark.databricks.delta.smallTable.cache.enabled", "false")
spark.conf.set("spark.databricks.delta.stats.localCache.maxNumFiles", "1")
spark.conf.set("spark.databricks.delta.fastQueryPath.dataskipping.checkpointCache.enabled", "false")
spark.conf.set("spark.databricks.io.cache.enabled", "false")
com.databricks.sql.transaction.tahoe.DeltaLog.clearCache()
spark.sql("CLEAR CACHE")
sqlContext.clearCache()  
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please find the above piece of custom method to clear all the cache in the cluster without restarting . This will clear the cache by invoking the method given below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%scala clearAllCaching()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The cache can be validated in the SPARK UI -&amp;gt; storage tab in the cluster.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Mar 2022 18:55:51 GMT</pubDate>
    <dc:creator>shan_chandra</dc:creator>
    <dc:date>2022-03-29T18:55:51Z</dc:date>
    <item>
      <title>How to clear all cache without restarting the cluster?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24340#M16909</link>
      <description />
      <pubDate>Tue, 29 Mar 2022 18:48:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24340#M16909</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2022-03-29T18:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear all cache without restarting the cluster?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24341#M16910</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;%scala
def clearAllCaching(tableName: Option[String] = None): Unit = {
tableName.map { path =&amp;gt;
com.databricks.sql.transaction.tahoe.DeltaValidation.invalidateCache(spark, path)
}
spark.conf.set("com.databricks.sql.io.caching.bucketedRead.enabled", "false")
spark.conf.set("spark.databricks.delta.smallTable.cache.enabled", "false")
spark.conf.set("spark.databricks.delta.stats.localCache.maxNumFiles", "1")
spark.conf.set("spark.databricks.delta.fastQueryPath.dataskipping.checkpointCache.enabled", "false")
spark.conf.set("spark.databricks.io.cache.enabled", "false")
com.databricks.sql.transaction.tahoe.DeltaLog.clearCache()
spark.sql("CLEAR CACHE")
sqlContext.clearCache()  
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please find the above piece of custom method to clear all the cache in the cluster without restarting . This will clear the cache by invoking the method given below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%scala clearAllCaching()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The cache can be validated in the SPARK UI -&amp;gt; storage tab in the cluster.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 18:55:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24341#M16910</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2022-03-29T18:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear all cache without restarting the cluster?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24342#M16911</link>
      <description>&lt;P&gt;Great. You can add ​ spark.catalog.clearCache() as well.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 19:53:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-clear-all-cache-without-restarting-the-cluster/m-p/24342#M16911</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-03-29T19:53:26Z</dc:date>
    </item>
  </channel>
</rss>

