package com.elab.cache.error.impl;

import com.elab.cache.ICacheClient;
import com.elab.cache.error.CacheErrorProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 简单的日志记录异常缓存处理结果
 *
 * @author Liukx
 * @create 2017-11-09 17:18
 * @email liukx@elab-plus.com
 **/
public class SimpleCacheErrorProcess implements CacheErrorProcess {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void handleCacheGetError(RuntimeException exception, ICacheClient cache, Object key) {
        logger.error("==============handleCacheGetError==================== [key]" + key, exception);
    }

    @Override
    public void handleCachePutError(RuntimeException exception, ICacheClient cache, Object key, Object value) {
        logger.error("==============handleCachePutError==================== [key]" + key + "=======[value]" + value, exception);
    }

    @Override
    public void handleCachePutError(RuntimeException exception, ICacheClient cache, Object key, Object filed, Object value) {
        logger.error("==============handleCachePutError==================== [key]" + key + "=======[value]" + value + "========[filed]========" + filed, exception);
    }

    @Override
    public void handleCacheEvictError(RuntimeException exception, ICacheClient cache, Object key) {
        logger.error("==============handleCacheEvictError====================", exception);
    }

    @Override
    public void handleCacheClearError(RuntimeException exception, ICacheClient cache) {
        logger.error("==============handleCacheClearError====================", exception);
    }
}
