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

com.github.xiaolyuh.manager.CacheManager Maven / Gradle / Ivy

package com.github.xiaolyuh.manager;

import com.github.xiaolyuh.cache.Cache;
import com.github.xiaolyuh.setting.LayeringCacheSetting;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Collection;

/**
 * 缓存管理器
 * 允许通过缓存名称来获的对应的 {@link Cache}.
 *
 * @author yuhao.wang3
 */
public interface CacheManager {

    /**
     * 根据缓存名称返回对应的{@link Collection}.
     *
     * @param name 缓存的名称 (不能为 {@code null})
     * @return 返回对应名称的Cache, 如果没找到返回 {@code null}
     */
    Collection getCache(String name);

    /**
     * 根据缓存名称返回对应的{@link Cache},如果没有找到就新建一个并放到容器
     *
     * @param name                 缓存名称
     * @param layeringCacheSetting 多级缓存配置
     * @return {@link Cache}
     */
    Cache getCache(String name, LayeringCacheSetting layeringCacheSetting);

    /**
     * 获取所有缓存名称的集合
     *
     * @return 所有缓存名称的集合
     */
    Collection getCacheNames();

    /**
     * 获取redis客户端
     *
     * @return {@link RedisTemplate}
     */
    RedisTemplate getRedisTemplate();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy