Hazelcast C++ Client
Hazelcast C++ Client Library
eviction_config.h
1 /*
2  * Copyright (c) 2008-2021, 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 <ostream>
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 
30 namespace hazelcast {
31  namespace client {
32  namespace config {
37  class HAZELCAST_API eviction_config {
38  public:
39  ~eviction_config() = default;
40 
48  ENTRY_COUNT
49  /* TODO,
50  *
51  * Policy based on maximum used native memory in megabytes per data structure (map, cache etc)
52  * on each Hazelcast instance
53 
54  USED_NATIVE_MEMORY_SIZE,
55  *
56  * Policy based on maximum used native memory percentage per data structure (map, cache etc)
57  * on each Hazelcast instance
58 
59  USED_NATIVE_MEMORY_PERCENTAGE,
60  *
61  * Policy based on minimum free native memory in megabytes per Hazelcast instance
62 
63  FREE_NATIVE_MEMORY_SIZE,
64  *
65  * Policy based on minimum free native memory percentage per Hazelcast instance
66 
67  FREE_NATIVE_MEMORY_PERCENTAGE*/
68  };
69 
73  static constexpr int32_t DEFAULT_MAX_ENTRY_COUNT = INT32_MAX;
74 
78  static constexpr max_size_policy DEFAULT_MAX_SIZE_POLICY = max_size_policy::ENTRY_COUNT;
79 
83  static constexpr eviction_policy DEFAULT_EVICTION_POLICY = eviction_policy::LRU;
84 
86 
87  int32_t get_size() const;
88 
89  eviction_config &set_size(int32_t size);
90 
91  max_size_policy get_maximum_size_policy() const;
92 
93  eviction_config &set_maximum_size_policy(const max_size_policy &max_size_policy);
94 
95  eviction_policy get_eviction_policy() const;
96 
97  eviction_config &set_eviction_policy(eviction_policy policy);
98 
99  eviction_strategy_type get_eviction_strategy_type() const;
100 
101  friend std::ostream HAZELCAST_API &operator<<(std::ostream &out, const eviction_config &config);
102 
103  protected:
104  int32_t size_;
105  max_size_policy max_size_policy_;
106  eviction_policy eviction_policy_;
107  };
108 
109  }
110  }
111 }
112 
113 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
114 #pragma warning(pop)
115 #endif
116 
117