LayeringCacheSyncCommandHandler.java 787 Bytes
package com.irrigation.icl.cache;

import com.irrigation.icl.cache.core.LayeringCache;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.CacheManager;

/**
 * @Author: boni
 * @Date: 2018/8/29-下午5:44
 */
@Slf4j
@Getter
public class LayeringCacheSyncCommandHandler {
    CacheManager cacheManager;

    public LayeringCacheSyncCommandHandler(CacheManager cacheManager) {
        this.cacheManager = cacheManager;
    }

    public void handle(Command command) {
        if (cacheManager != null) {
            LayeringCache layeringCache = (LayeringCache) cacheManager.getCache(command.getName());
            if (layeringCache == null) {
                return;
            }
            layeringCache.updateL1Cache(command);
        }
    }
}