package com.ss.android.ugc.effectmanager.common.cache;

import X.2HN;
import X.7hc;
import X.7he;
import X.Crj;
import X.KEM;
import X.M12;
import X.PMk;
import X.PMp;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.effectmanager.common.cachemanager.ICache;
import java.util.HashMap;

public final class EffectCacheManager {
    public static final Companion Companion = new Companion((2HN) null);
    public static final Crj instance$delegate = 7he.LIZ(7hc.SYNCHRONIZED, EffectCacheManager$Companion$instance$2.INSTANCE);
    public HashMap<String, ICache> caches;

    public static final class Companion {
        public static final /* synthetic */ PMp[] $$delegatedProperties = {new PMk(KEM.LIZ.LIZ(Companion.class), "instance", "getInstance()Lcom/ss/android/ugc/effectmanager/common/cache/EffectCacheManager;")};

        public final EffectCacheManager getInstance() {
            return (EffectCacheManager) EffectCacheManager.instance$delegate.getValue();
        }

        public Companion() {
        }

        static {
            Covode.recordClassIndex(125247);
        }

        public /* synthetic */ Companion(2HN r1) {
            this();
        }
    }

    public EffectCacheManager() {
        this.caches = new HashMap<>();
    }

    static {
        Covode.recordClassIndex(125246);
    }

    public /* synthetic */ EffectCacheManager(2HN r1) {
        this();
    }

    public final synchronized ICache getCache(String str) {
        MethodCollector.i(11932);
        M12.LIZ(str);
        if (TextUtils.isEmpty(str)) {
            MethodCollector.o(11932);
            return null;
        } else if (!this.caches.containsKey(str)) {
            MethodCollector.o(11932);
            return null;
        } else {
            ICache iCache = this.caches.get(str);
            MethodCollector.o(11932);
            return iCache;
        }
    }

    public final synchronized void setCache(String str, ICache iCache) {
        MethodCollector.i(12146);
        M12.LIZ(str);
        this.caches.put(str, iCache);
        MethodCollector.o(12146);
    }
}
