org.nervousync.cache.api.CacheManager Maven / Gradle / Ivy
/*
* Copyright 2022 Nervousync Studio
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nervousync.cache.api;
public interface CacheManager {
/**
* Register cache instance by given cache name and config instance
* 使用指定的缓存名称、配置信息注册缓存
*
* @param cacheName Cache name
* 缓存名称
* @param cacheConfig Cache config instance
* 缓存配置信息
*/
boolean register(final String cacheName, final Object cacheConfig);
/**
* Retrieve cache client instance by given cache name
* 使用指定的缓存名称获取缓存操作客户端
*
* @param cacheName Cache name
* 缓存名称
* @return Cache client instance or null if cache name not registered
* 缓存客户端实例,若缓存名称未注册则返回null
*/
CacheClient client(final String cacheName);
/**
* Remove cache instance from registered list
* 移除指定的缓存
*
* @param cacheName Cache name
* 缓存名称
*/
void deregister(final String cacheName);
/**
* Destroy manager instance
* 销毁当前的管理实例
*/
void destroy();
}