-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathconfdata-state.h
More file actions
35 lines (25 loc) · 1 KB
/
confdata-state.h
File metadata and controls
35 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Compiler for PHP (aka KPHP)
// Copyright (c) 2025 LLC «V Kontakte»
// Distributed under the GPL v3 License, see LICENSE.notice.txt
#pragma once
#include <cstddef>
#include <cstdint>
#include "common/mixin/not_copyable.h"
#include "runtime-common/core/allocator/script-allocator.h"
#include "runtime-common/core/runtime-core.h"
#include "runtime-common/core/std/containers.h"
class ConfdataInstanceState final : private vk::not_copyable {
using hasher_type = decltype([](const string& s) noexcept { return static_cast<size_t>(s.hash()); });
kphp::stl::unordered_map<string, mixed, kphp::memory::script_allocator, hasher_type> m_key_cache;
kphp::stl::unordered_map<string, array<mixed>, kphp::memory::script_allocator, hasher_type> m_wildcard_cache;
public:
uint64_t time_ns{};
ConfdataInstanceState() noexcept = default;
auto& key_cache() noexcept {
return m_key_cache;
}
auto& wildcard_cache() noexcept {
return m_wildcard_cache;
}
static ConfdataInstanceState& get() noexcept;
};