Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
near_cache_config.h
1/*
2 * Copyright (c) 2008-2025, Hazelcast, Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include "hazelcast/client/config/in_memory_format.h"
19#include "hazelcast/client/config/eviction_config.h"
20
21#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
22#pragma warning(push)
23#pragma warning(disable : 4251) // for dll export
24#endif
25
26namespace hazelcast {
27namespace client {
28namespace config {
33class HAZELCAST_API near_cache_config
34{
35public:
39 static constexpr int32_t DEFAULT_TTL_SECONDS = 0;
40
44 static constexpr int32_t DEFAULT_MAX_IDLE_SECONDS = 0;
45
49 static constexpr in_memory_format DEFAULT_MEMORY_FORMAT =
50 in_memory_format::BINARY;
51
67
69
70 near_cache_config(const std::string& cache_name);
71
72 near_cache_config(const std::string& cache_name,
73 in_memory_format memory_format);
74
75 near_cache_config(int32_t time_to_live_seconds,
76 int32_t max_idle_seconds,
77 bool invalidate_on_change,
78 in_memory_format in_memory_format,
79 const eviction_config& evict_config);
80
81 virtual ~near_cache_config() = default;
82
88 const std::string& get_name() const;
89
96 near_cache_config& set_name(const std::string& name);
97
106 int32_t get_time_to_live_seconds() const;
107
118 near_cache_config& set_time_to_live_seconds(int32_t time_to_live_seconds);
119
128 int32_t get_max_idle_seconds() const;
129
140 near_cache_config& set_max_idle_seconds(int32_t max_idle_seconds);
141
152 bool is_invalidate_on_change() const;
153
166 near_cache_config& set_invalidate_on_change(bool invalidate_on_change);
167
176 const in_memory_format& get_in_memory_format() const;
177
187 virtual near_cache_config& set_in_memory_format(
188 const in_memory_format& in_memory_format);
189
198 bool is_cache_local_entries() const;
199
209 near_cache_config& set_cache_local_entries(bool cache_local_entries);
210
211 const local_update_policy& get_local_update_policy() const;
212
213 near_cache_config& set_local_update_policy(
214 const local_update_policy& local_update_policy);
215
221 eviction_config& get_eviction_config();
222
229 near_cache_config& set_eviction_config(
231
232 friend std::ostream HAZELCAST_API& operator<<(
233 std::ostream& out,
234 const near_cache_config& cache_config);
235
236private:
237 std::string name_;
238
239 int32_t time_to_live_seconds_;
240 int32_t max_idle_seconds_;
241
242 in_memory_format in_memory_format_;
243
244 local_update_policy local_update_policy_;
245
246 bool invalidate_on_change_;
247 bool cache_local_entries_;
248
257 eviction_config eviction_config_;
258};
259
260} // namespace config
261} // namespace client
262} // namespace hazelcast
263
264#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
265#pragma warning(pop)
266#endif
Contains the configuration for a Near Cache.
static constexpr in_memory_format DEFAULT_MEMORY_FORMAT
Default value for the in-memory format.
static constexpr int32_t DEFAULT_MAX_IDLE_SECONDS
Default value of the idle time for eviction in seconds.
static constexpr int32_t DEFAULT_TTL_SECONDS
Default value of the time to live in seconds.