opensearch_client/common/query_cache_stats.rs
1/*
2 * opensearch-client
3 *
4 * Rust Client for OpenSearch
5 *
6 * The version of the OpenAPI document: 3.1.0
7 * Contact: alberto.paro@gmail.com
8 * Generated by Paro OpenAPI Generator
9 */
10
11use serde::{Deserialize, Serialize};
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct QueryCacheStats {
15 /// The total number of hits and misses stored in the query cache across all shards assigned to the selected nodes.
16 #[serde(rename = "total_count")]
17 pub total_count: u32,
18 /// The total number of entries currently stored in the query cache across all shards assigned to the selected nodes.
19 #[serde(rename = "cache_size")]
20 pub cache_size: u32,
21 #[serde(
22 rename = "memory_size",
23 default,
24 skip_serializing_if = "Option::is_none"
25 )]
26 pub memory_size: Option<String>,
27 /// The total number of query cache hits across all shards assigned to the selected nodes.
28 #[serde(rename = "hit_count")]
29 pub hit_count: u32,
30 /// The total number of entries added to the query cache across all shards assigned to the selected nodes.
31 /// This number includes all current and evicted entries.
32 #[serde(rename = "cache_count")]
33 pub cache_count: u32,
34 /// The total number of query cache misses across all shards assigned to the selected nodes.
35 #[serde(rename = "miss_count")]
36 pub miss_count: u32,
37 /// The total number of query cache evictions across all shards assigned to the selected nodes.
38 #[serde(rename = "evictions")]
39 pub evictions: u32,
40 #[serde(rename = "memory_size_in_bytes")]
41 pub memory_size_in_bytes: u32,
42}
43
44impl QueryCacheStats {
45 pub fn new(
46 total_count: u32,
47 cache_size: u32,
48 hit_count: u32,
49 cache_count: u32,
50 miss_count: u32,
51 evictions: u32,
52 memory_size_in_bytes: u32,
53 ) -> QueryCacheStats {
54 QueryCacheStats {
55 total_count,
56 cache_size,
57 memory_size: None,
58 hit_count,
59 cache_count,
60 miss_count,
61 evictions,
62 memory_size_in_bytes,
63 }
64 }
65}