discord-jadx/app/src/main/java/c/i/a/c/h2/y/o.java

50 lines
1.2 KiB
Java

package c.i.a.c.h2.y;
import com.google.android.exoplayer2.upstream.cache.Cache;
import java.util.TreeSet;
/* compiled from: LeastRecentlyUsedCacheEvictor */
public final class o implements d {
public final TreeSet<h> a = new TreeSet<>(b.i);
public long b;
public o(long j) {
}
@Override // c.i.a.c.h2.y.d
public void a(Cache cache, String str, long j, long j2) {
if (j2 != -1) {
f(cache, j2);
}
}
@Override // com.google.android.exoplayer2.upstream.cache.Cache.a
public void b(Cache cache, h hVar) {
this.a.remove(hVar);
this.b -= hVar.k;
}
@Override // com.google.android.exoplayer2.upstream.cache.Cache.a
public void c(Cache cache, h hVar, h hVar2) {
this.a.remove(hVar);
this.b -= hVar.k;
d(cache, hVar2);
}
@Override // com.google.android.exoplayer2.upstream.cache.Cache.a
public void d(Cache cache, h hVar) {
this.a.add(hVar);
this.b += hVar.k;
f(cache, 0);
}
@Override // c.i.a.c.h2.y.d
public void e() {
}
public final void f(Cache cache, long j) {
while (this.b + j > 104857600 && !this.a.isEmpty()) {
cache.d(this.a.first());
}
}
}