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

com.hazelcast.cache.impl.nearcache.NearCacheManager Maven / Gradle / Ivy

/*
 * Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
 *
 * 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 com.hazelcast.cache.impl.nearcache;

import com.hazelcast.config.NearCacheConfig;

import java.util.Collection;

/**
 * {@link NearCacheManager} is the contract point to manage all existing
 * {@link com.hazelcast.cache.impl.nearcache.NearCache} instances.
 */
public interface NearCacheManager {

    /**
     * Gets the {@link com.hazelcast.cache.impl.nearcache.NearCache} instance
     * associated with given name.
     *
     * @param name the name of the {@link com.hazelcast.cache.impl.nearcache.NearCache} instance will be got
     * @param  the type of the key for Near Cache
     * @param  the type of the value for Near Cache
     * @return the {@link com.hazelcast.cache.impl.nearcache.NearCache} instance
     *         associated with given name
     */
     NearCache getNearCache(String name);

    /**
     * Creates a new {@link com.hazelcast.cache.impl.nearcache.NearCache} with given configurations
     * or returns existing one.
     *
     * @param name              the name of the {@link com.hazelcast.cache.impl.nearcache.NearCache}
     *                          to be created or existing one
     * @param nearCacheConfig   the {@link com.hazelcast.config.NearCacheConfig} of the
     *                          {@link com.hazelcast.cache.impl.nearcache.NearCache} to be created
     * @param nearCacheContext  the {@link com.hazelcast.cache.impl.nearcache.NearCacheContext} of the
     *                          {@link com.hazelcast.cache.impl.nearcache.NearCache} to be created
     * @param  the key type of the {@link com.hazelcast.cache.impl.nearcache.NearCache}
     * @param  the value type of the {@link com.hazelcast.cache.impl.nearcache.NearCache}
     * @return the created or existing {@link com.hazelcast.cache.impl.nearcache.NearCache} instance
     *         associated with given name
     */
     NearCache getOrCreateNearCache(String name, NearCacheConfig nearCacheConfig,
                                                NearCacheContext nearCacheContext);

    /**
     * Lists all existing {@link com.hazelcast.cache.impl.nearcache.NearCache} instances.
     *
     * @return all existing {@link com.hazelcast.cache.impl.nearcache.NearCache} instances
     */
    Collection listAllNearCaches();

    /**
     * Clears {@link com.hazelcast.cache.impl.nearcache.NearCache} instance associated with given name
     * but not removes it.
     *
     * @param name name of the {@link com.hazelcast.cache.impl.nearcache.NearCache} to be cleared
     * @return true if {@link com.hazelcast.cache.impl.nearcache.NearCache}
     *         was found and cleared, otherwise false
     */
    boolean clearNearCache(String name);

    /**
     * Clears all defined {@link com.hazelcast.cache.impl.nearcache.NearCache} instances.
     */
    void clearAllNearCaches();

    /**
     * Destroys {@link com.hazelcast.cache.impl.nearcache.NearCache} instance associated with given name
     * and also removes it.
     *
     * @param name name of the {@link com.hazelcast.cache.impl.nearcache.NearCache} to be destroyed
     * @return true if {@link com.hazelcast.cache.impl.nearcache.NearCache}
     *         was found and destroyed, otherwise false
     */
    boolean destroyNearCache(String name);

    /**
     * Destroys all defined {@link com.hazelcast.cache.impl.nearcache.NearCache} instances.
     */
    void destroyAllNearCaches();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy