<p dir="auto">Hi,<br>
First of all, thank you very much for an awesome library.<br>
I switched from Picasso to Glide, and I like Glide more than Picasso.  However,<br>
I've noticed that Glide would load the old image (deleted) instead of the new image.</p>
<p dir="auto">For example,<br>
I have the following images on my listview:<br>
Image1<br>
Image2<br>
Image3<br>
etc.</p>
<p dir="auto">I deleted Image1, and renamed Image2 to Image1.<br>
Glide would display the old picture of Image1 which was deleted instead of Image2 picture.</p>
<p dir="auto">I went online and searched for the solution, they said that I can clear the caches with the following:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public void Clear_GlideCaches() {
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Glide.get(MainActivity.this).clearMemory();
        }}, 0);

    AsyncTask.execute(new Runnable() {
        @Override
        public void run() {
            Glide.get(MainActivity.this).clearDiskCache();
        }
    });
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">Clear_GlideCaches</span>() {
    <span class="pl-k">new</span> <span class="pl-smi">Handler</span>().<span class="pl-en">postDelayed</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
        <span class="pl-c1">@</span><span class="pl-c1">Override</span>
        <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
            <span class="pl-smi">Glide</span>.<span class="pl-en">get</span>(<span class="pl-smi">MainActivity</span>.<span class="pl-smi">this</span>).<span class="pl-en">clearMemory</span>();
        }}, <span class="pl-c1">0</span>);

    <span class="pl-smi">AsyncTask</span>.<span class="pl-en">execute</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
        <span class="pl-c1">@</span><span class="pl-c1">Override</span>
        <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">run</span>() {
            <span class="pl-smi">Glide</span>.<span class="pl-en">get</span>(<span class="pl-smi">MainActivity</span>.<span class="pl-smi">this</span>).<span class="pl-en">clearDiskCache</span>();
        }
    });
}</pre></div>
<p dir="auto">This solution didn't seem to work for my situation as Glide still loads the old deleted images.</p>
<p dir="auto">Here is my listview adapter:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override public View getView(int position, View recycledView, ViewGroup container) {
    ViewHolder viewHolder = new ViewHolder();
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (recycledView == null) {
        recycledView = inflater.inflate(R.layout.listview_layout, container, false);
        viewHolder.layout = (RelativeLayout)recycledView.findViewById(R.id.ListViewLayout);
        viewHolder.imageView = (ImageView)recycledView.findViewById(R.id.ListViewImage); 
        recycledView.setTag(viewHolder);  
    } else {
        viewHolder = (ViewHolder)recycledView.getTag();
    }

    Glide
    .with(mContext)
    .load(getItem(position).getImageUri())
    .centerCrop()
    .placeholder(R.color.black)
    .crossFade()
    .into(viewHolder.imageView);

    return recycledView;
} 

class ViewHolder {
    RelativeLayout layout;
    ImageView imageView;
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span> <span class="pl-k">public</span> <span class="pl-smi">View</span> <span class="pl-s1">getView</span>(<span class="pl-smi">int</span> <span class="pl-s1">position</span>, <span class="pl-smi">View</span> <span class="pl-s1">recycledView</span>, <span class="pl-smi">ViewGroup</span> <span class="pl-s1">container</span>) {
    <span class="pl-smi">ViewHolder</span> <span class="pl-s1">viewHolder</span> = <span class="pl-k">new</span> <span class="pl-smi">ViewHolder</span>();
    <span class="pl-smi">LayoutInflater</span> <span class="pl-s1">inflater</span> = (<span class="pl-smi">LayoutInflater</span>) <span class="pl-s1">mContext</span>.<span class="pl-en">getSystemService</span>(<span class="pl-smi">Context</span>.<span class="pl-c1">LAYOUT_INFLATER_SERVICE</span>);
    <span class="pl-k">if</span> (<span class="pl-s1">recycledView</span> == <span class="pl-c1">null</span>) {
        <span class="pl-s1">recycledView</span> = <span class="pl-s1">inflater</span>.<span class="pl-en">inflate</span>(<span class="pl-smi">R</span>.<span class="pl-s1">layout</span>.<span class="pl-s1">listview_layout</span>, <span class="pl-s1">container</span>, <span class="pl-c1">false</span>);
        <span class="pl-s1">viewHolder</span>.<span class="pl-s1">layout</span> = (<span class="pl-smi">RelativeLayout</span>)<span class="pl-s1">recycledView</span>.<span class="pl-en">findViewById</span>(<span class="pl-smi">R</span>.<span class="pl-s1">id</span>.<span class="pl-s1">ListViewLayout</span>);
        <span class="pl-s1">viewHolder</span>.<span class="pl-s1">imageView</span> = (<span class="pl-smi">ImageView</span>)<span class="pl-s1">recycledView</span>.<span class="pl-en">findViewById</span>(<span class="pl-smi">R</span>.<span class="pl-s1">id</span>.<span class="pl-s1">ListViewImage</span>); 
        <span class="pl-s1">recycledView</span>.<span class="pl-en">setTag</span>(<span class="pl-s1">viewHolder</span>);  
    } <span class="pl-k">else</span> {
        <span class="pl-s1">viewHolder</span> = (<span class="pl-smi">ViewHolder</span>)<span class="pl-s1">recycledView</span>.<span class="pl-en">getTag</span>();
    }

    <span class="pl-smi">Glide</span>
    .<span class="pl-en">with</span>(<span class="pl-s1">mContext</span>)
    .<span class="pl-en">load</span>(<span class="pl-en">getItem</span>(<span class="pl-s1">position</span>).<span class="pl-en">getImageUri</span>())
    .<span class="pl-en">centerCrop</span>()
    .<span class="pl-en">placeholder</span>(<span class="pl-smi">R</span>.<span class="pl-s1">color</span>.<span class="pl-s1">black</span>)
    .<span class="pl-en">crossFade</span>()
    .<span class="pl-en">into</span>(<span class="pl-s1">viewHolder</span>.<span class="pl-s1">imageView</span>);

    <span class="pl-k">return</span> <span class="pl-s1">recycledView</span>;
} 

<span class="pl-k">class</span> <span class="pl-smi">ViewHolder</span> {
    <span class="pl-smi">RelativeLayout</span> <span class="pl-s1">layout</span>;
    <span class="pl-smi">ImageView</span> <span class="pl-s1">imageView</span>;
}</pre></div>
<p dir="auto">On Picasso,<br>
I was able to clear the image cache for specific image without any issues.</p>
<p dir="auto">Here is the code:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public class ClearPicassoCaches {
    public static void clearCache (Picasso p) {
        p.cache.clear();
    }
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">ClearPicassoCaches</span> {
    <span class="pl-k">public</span> <span class="pl-k">static</span> <span class="pl-smi">void</span> <span class="pl-en">clearCache</span> (<span class="pl-smi">Picasso</span> <span class="pl-s1">p</span>) {
        <span class="pl-s1">p</span>.<span class="pl-s1">cache</span>.<span class="pl-en">clear</span>();
    }
}</pre></div>
<p dir="auto">In ListView Adapter:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public void RefreshPicassoCache(String path) {
      Picasso.with(mContext).invalidate(&quot;file:///&quot; + path);
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">RefreshPicassoCache</span>(<span class="pl-smi">String</span> <span class="pl-s1">path</span>) {
      <span class="pl-smi">Picasso</span>.<span class="pl-en">with</span>(<span class="pl-s1">mContext</span>).<span class="pl-en">invalidate</span>(<span class="pl-s">"file:///"</span> + <span class="pl-s1">path</span>);
}</pre></div>
<p dir="auto">In MainActivity:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="listViewAdapter.RefreshPicassoCache(NewPath);   //to refresh the specific image cache."><pre class="notranslate"><span class="pl-s1">listViewAdapter</span>.<span class="pl-en">RefreshPicassoCache</span>(<span class="pl-s1">NewPath</span>);   <span class="pl-c">//to refresh the specific image cache.</span></pre></div>
<p dir="auto">My questions are:</p>
<p dir="auto">1)is there a way to refresh (reset) the cache for specific image?<br>
2) is there anyway I can clear the Glide caches, so that it won't display the old deleted images when the deleted and the new images have the same name.?</p>
<p dir="auto">I am testing my app on Android 5.1.1 (Lollittlepoop), GN4<br>
<strong>Glide Version</strong>: 3.7.0</p>
<p dir="auto">I hope someone can help me,</p>
<p dir="auto">Thank you very much</p>
<p dir="auto">Hi,<br>
How can I clear Glide's cache in case.</p>
<ul dir="auto">
<li>Clear all cache</li>
<li>Clear cache of an URL.</li>
</ul>