Package com.dotcms.content.elasticsearch.business

Source Code of com.dotcms.content.elasticsearch.business.IndiciesCacheImpl

package com.dotcms.content.elasticsearch.business;

import com.dotcms.content.elasticsearch.business.IndiciesAPI.IndiciesInfo;
import com.dotmarketing.business.CacheLocator;
import com.dotmarketing.business.DotCacheAdministrator;
import com.dotmarketing.util.Logger;

public class IndiciesCacheImpl implements IndiciesCache {
   
    protected final DotCacheAdministrator cache;
   
    protected final String primaryGroup = "IndiciesCache";
    protected final String[] groupNames = {primaryGroup};

    public IndiciesCacheImpl() {
        cache = CacheLocator.getCacheAdministrator();
    }
   
    public String getPrimaryGroup() {
        return primaryGroup;
    }
   
    public String[] getGroups() {
        return groupNames;
    }
   
    public void clearCache() {
        cache.flushGroup(primaryGroup);
    }
   
    public IndiciesInfo get() {
        IndiciesInfo info=null;
        try {
            info=(IndiciesInfo)cache.get(primaryGroup+"info", primaryGroup);
        }
        catch(Exception ex) {
            Logger.warn(this, "can't get cache entry",ex);
        }
        return info;
    }
   
    public void put(IndiciesInfo info) {
        cache.put(primaryGroup+"info", info, primaryGroup);
    }
}
TOP

Related Classes of com.dotcms.content.elasticsearch.business.IndiciesCacheImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.