Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
eviction_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 <string>
19#include <iosfwd>
20
21#include "hazelcast/client/config/eviction_policy.h"
22#include "eviction_strategy_type.h"
23#include "eviction_strategy_type.h"
24
25#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26#pragma warning(push)
27#pragma warning(disable : 4251) // for dll export
28#endif
29
30namespace hazelcast {
31namespace client {
32namespace config {
37class HAZELCAST_API eviction_config
38{
39public:
40 ~eviction_config() = default;
41
46 {
52 /* TODO,
53 *
54 * Policy based on maximum used native memory in megabytes per data
55 structure (map, cache etc)
56 * on each Hazelcast instance
57
58 USED_NATIVE_MEMORY_SIZE,
59 *
60 * Policy based on maximum used native memory percentage per data
61 structure (map, cache etc)
62 * on each Hazelcast instance
63
64 USED_NATIVE_MEMORY_PERCENTAGE,
65 *
66 * Policy based on minimum free native memory in megabytes per Hazelcast
67 instance
68
69 FREE_NATIVE_MEMORY_SIZE,
70 *
71 * Policy based on minimum free native memory percentage per Hazelcast
72 instance
73
74 FREE_NATIVE_MEMORY_PERCENTAGE*/
75 };
76
80 static constexpr int32_t DEFAULT_MAX_ENTRY_COUNT = INT32_MAX;
81
87
91 static constexpr eviction_policy DEFAULT_EVICTION_POLICY =
92 eviction_policy::LRU;
93
94 eviction_config();
95
96 int32_t get_size() const;
97
98 eviction_config& set_size(int32_t size);
99
100 max_size_policy get_maximum_size_policy() const;
101
102 eviction_config& set_maximum_size_policy(
104
105 eviction_policy get_eviction_policy() const;
106
107 eviction_config& set_eviction_policy(eviction_policy policy);
108
109 eviction_strategy_type get_eviction_strategy_type() const;
110
111 friend std::ostream HAZELCAST_API& operator<<(
112 std::ostream& out,
113 const eviction_config& config);
114
115protected:
116 int32_t size_;
117 max_size_policy max_size_policy_;
118 eviction_policy eviction_policy_;
119};
120
121} // namespace config
122} // namespace client
123} // namespace hazelcast
124
125#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
126#pragma warning(pop)
127#endif
static constexpr eviction_policy DEFAULT_EVICTION_POLICY
Default Eviction Policy.
static constexpr int32_t DEFAULT_MAX_ENTRY_COUNT
Default maximum entry count.
static constexpr max_size_policy DEFAULT_MAX_SIZE_POLICY
Default Max-Size Policy.
@ ENTRY_COUNT
Policy based on maximum number of entries stored per data structure (map, cache etc)