C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/net/CacheService.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_CACHE_SERVICE_HPP
00008 #define COH_CACHE_SERVICE_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/net/NamedCache.hpp"
00013 #include "coherence/net/Service.hpp"
00014 #include "coherence/util/Collection.hpp"
00015 
00016 COH_OPEN_NAMESPACE2(coherence,net)
00017 
00018 using coherence::util::Collection;
00019 
00020 
00021 /**
00022 * A CacheService is a clustered service providing a collection of named Maps
00023 * that hold resources shared among members of a cluster. These resources are
00024 * expected to be managed in memory, and are typically composed of data that
00025 * are also stored persistently in a database, or data that have been
00026 * assembled or calculated at some significant cost, thus these resources are
00027 * referred to as <i>cached</i>.
00028 *
00029 * @author jh  2007.12.21
00030 */
00031 class COH_EXPORT CacheService
00032     : public interface_spec<CacheService,
00033         implements<Service> >
00034     {
00035     // ----- CacheService interface -----------------------------------------
00036 
00037     public:
00038         /**
00039         * Obtain a NamedCache interface that provides a view of resources
00040         * shared among members of a cluster. The view is identified by name
00041         * within this CacheService. Typically, repeated calls to this method
00042         * with the same view name and class loader instance will result in
00043         * the same view reference being returned.
00044         *
00045         * @param vsName  the name, within this CacheService, that uniquely
00046         *                identifies a view; null is legal, and may imply a
00047         *                default name
00048         *
00049         * @return a NamedCache interface which can be used to access the
00050         *         resources of the specified view
00051         *
00052         * @throws IllegalStateException thrown if the service is not
00053         *                                  running
00054         */
00055         virtual NamedCache::Handle ensureCache(String::View vsName) = 0;
00056 
00057         /**
00058         * Returns a Collection of String objects, one for each cache name
00059         * that has been previously registered with this CacheService.
00060         *
00061         * @return a Collection of cache names
00062         *
00063         * @throws IllegalStateException thrown if the CacheService
00064         *            is not running or has stopped
00065         */
00066         virtual Collection::View getCacheNames() const = 0;
00067 
00068         /**
00069         * Release local resources associated with the specified instance of
00070         * the cache. This invalidates a reference obtained by using the
00071         * {@link #ensureCache(String::View)} method.
00072         *
00073         * Releasing a Map reference to a cache makes the Map reference no
00074         * longer usable, but does not affect the cache itself. In other
00075         * words, all other references to the cache will still be valid, and
00076         * the cache data is not affected by releasing the reference.
00077         *
00078         * The reference that is released using this method can no longer be
00079         * used; any attempt to use the reference will result in an exception.
00080         *
00081         * The purpose for releasing a cache reference is to allow the cache
00082         * implementation to release resources.
00083         *
00084         * @param hMap  the cache object to be released
00085         *
00086         * @see NamedCache#release()
00087         */
00088         virtual void releaseCache(NamedCache::Handle hMap) = 0;
00089 
00090         /**
00091         * Release and destroy the specified cache.
00092         *
00093         * <b>Warning:</b> This method is used to completely destroy the
00094         * specified cache across the cluster. All references in the entire
00095         * cluster to this cache will be invalidated, the cached data will be
00096         * cleared, and all resources will be released.
00097         *
00098         * @param hMap  the cache object to be released
00099         *
00100         * @see NamedCache#destroy()
00101         */
00102         virtual void destroyCache(NamedCache::Handle hMap) = 0;
00103     };
00104 
00105 COH_CLOSE_NAMESPACE2
00106 
00107 #endif // COH_CACHE_SERVICE_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.