VMware Tanzu GemFire Native C++ Reference 10.2.7
Cache.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#ifndef GEODE_CACHE_H_
21#define GEODE_CACHE_H_
22
23#include <string>
24
25#include <geode/util/LogLevel.hpp>
26
27#include "GeodeCache.hpp"
28#include "internal/geode_globals.hpp"
29
34namespace apache {
35namespace geode {
36namespace client {
37
38class AuthenticatedView;
39class AuthInitialize;
40class CacheFactory;
41class CacheImpl;
42class CacheRegionHelper;
43class CacheTransactionManager;
44class DataInput;
45class DataOutput;
46class Pool;
47class PoolFactory;
48class PoolManager;
49class Properties;
50class QueryService;
51class Region;
52class RegionFactory;
53class TypeRegistry;
54enum class RegionShortcut;
55
69class APACHE_GEODE_EXPORT Cache : public GeodeCache {
73 public:
82 virtual RegionFactory createRegionFactory(RegionShortcut regionShortcut);
83
90 void initializeDeclarativeCache(const std::string& cacheXml) override;
91
95 const std::string& getName() const override;
96
105 bool isClosed() const override;
106
112
122 void close() override;
123
134 virtual void close(bool keepalive);
135
146 std::shared_ptr<Region> getRegion(const std::string& path) const override;
147
153 std::vector<std::shared_ptr<Region>> rootRegions() const override;
154
159 std::shared_ptr<QueryService> getQueryService() override;
160
168 virtual std::shared_ptr<QueryService> getQueryService(
169 const std::string& poolName) const;
170
174 virtual void readyForEvents();
175
200 const std::shared_ptr<Properties>& userSecurityProperties,
201 const std::string& poolName);
202
208 virtual std::shared_ptr<CacheTransactionManager> getCacheTransactionManager()
209 const;
210
214 bool getPdxIgnoreUnreadFields() const override;
215
220 bool getPdxReadSerialized() const override;
221
230 const std::string& className) const override;
231
242 const std::string& className, bool expectDomainClass) const override;
243
244 virtual DataInput createDataInput(const uint8_t* m_buffer, size_t len) const;
245
246 virtual DataOutput createDataOutput() const;
247
248 virtual PoolManager& getPoolManager() const;
249
250 SystemProperties& getSystemProperties() const override;
251
255 void setLogLevel(LogLevel newLevel);
256
261 LogLevel getLogLevel();
262
263 Cache() = delete;
264 virtual ~Cache();
265 Cache(const Cache& other) = delete;
266 Cache& operator=(const Cache& other) = delete;
267 Cache(Cache&& other) noexcept;
268 Cache& operator=(Cache&& other) noexcept;
269
270 private:
274 Cache(const std::shared_ptr<Properties>& dsProp, bool ignorePdxUnreadFields,
275 bool readPdxSerialized,
276 const std::shared_ptr<AuthInitialize>& authInitialize);
277
278 std::unique_ptr<CacheImpl> m_cacheImpl;
279
280 protected:
281 friend class CacheFactory;
282 friend class CacheRegionHelper;
283 friend class FunctionService;
284 friend class CacheXmlCreation;
285 friend class RegionXmlCreation;
286};
287} // namespace client
288} // namespace geode
289} // namespace apache
290
291#endif // GEODE_CACHE_H_
Creates an authenticated cache view to allow credential based access to region services.
Definition: AuthenticatedView.hpp:46
Caches are obtained from the create method on the CacheFactory#create class.
Definition: Cache.hpp:69
virtual std::shared_ptr< CacheTransactionManager > getCacheTransactionManager() const
Get the CacheTransactionManager instance for this Cache.
std::vector< std::shared_ptr< Region > > rootRegions() const override
Returns a set of root regions in the cache.
virtual AuthenticatedView createAuthenticatedView(const std::shared_ptr< Properties > &userSecurityProperties, const std::string &poolName)
Creates an authenticated cache using the given user security properties.
std::shared_ptr< QueryService > getQueryService() override
Gets the QueryService from which a new Query can be obtained.
TypeRegistry & getTypeRegistry() const
Returns the type registry that this cache was created with.
void close() override
Terminates this object cache and releases all the local resources.
PdxInstanceFactory createPdxInstanceFactory(const std::string &className, bool expectDomainClass) const override
Returns a factory that can create a PdxInstance.
virtual void close(bool keepalive)
Terminates this object cache and releases all the local resources.
LogLevel getLogLevel()
Returns the current log level.
bool getPdxReadSerialized() const override
Returns whether PdxInstance is preferred for PDX types instead of C++ object.
bool isClosed() const override
Indicates if this cache has been closed.
void setLogLevel(LogLevel newLevel)
Changes the current log level to newLogLevel.
std::shared_ptr< Region > getRegion(const std::string &path) const override
Look up a region with the full path from root.
bool getPdxIgnoreUnreadFields() const override
Returns whether Cache saves unread fields for Pdx types.
virtual void readyForEvents()
Send the "client ready" message to the server from a durable client.
PdxInstanceFactory createPdxInstanceFactory(const std::string &className) const override
Returns a factory that can create a PdxInstance.
virtual RegionFactory createRegionFactory(RegionShortcut regionShortcut)
public methods
const std::string & getName() const override
Returns the name of this cache.
void initializeDeclarativeCache(const std::string &cacheXml) override
Initializes the cache from an xml file.
virtual std::shared_ptr< QueryService > getQueryService(const std::string &poolName) const
Gets the QueryService from which a new Query can be obtained.
Top level class for configuring and using Geode on a client.This should be called once to create Cach...
Definition: CacheFactory.hpp:48
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:59
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:48
entry point for function execution
Definition: FunctionService.hpp:45
GeodeCache represents the singleton cache that must be created in order to connect to Geode server.
Definition: GeodeCache.hpp:48
PdxInstanceFactory gives you a way to create PdxInstances.
Definition: PdxInstanceFactory.hpp:52
Manages creation and access to connection pools for clients.
Definition: PoolManager.hpp:61
Provides for the configuration and creation of instances of Region.
Definition: RegionFactory.hpp:43
The SystemProperties class.
Definition: SystemProperties.hpp:44
Registry for custom serializable types, both PDXSerializable and DataSerializable.
Definition: TypeRegistry.hpp:39

Apache Geode C++ Cache API Documentation