All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.cache.provider.DefaultDataCacheProvider Maven / Gradle / Ivy

There is a newer version: 2.5.2.RELEASE
Show newest version
package com.feingto.cloud.cache.provider;

import com.feingto.cloud.cache.IDataCache;

import java.util.List;
import java.util.Map;

/**
 * 缓存扩展接口默认实现
 *
 * @author longfei
 */
@SuppressWarnings("unchecked")
public class DefaultDataCacheProvider extends DefaultCacheProvider implements IDataCache {
    private boolean isLoaded = false;

    @Override
    public  List getList(String key) {
        if (!isLoaded) {
            this.sync();
        }

        return (List) data.get(key);
    }

    @Override
    public  Map getMap(String key) {
        if (!this.isLoaded) {
            this.sync();
        }

        return (Map) this.filterExpire(data.get(key), key);
    }

    @Override
    public synchronized boolean sync() {
        isLoaded = true;
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy