@@ -20,29 +20,9 @@ import (
20
20
21
21
// DNSConfigCache is a thread-safe cache for DNS configuration components
22
22
type DNSConfigCache struct {
23
- CustomZones sync.Map
24
23
NameServerGroups sync.Map
25
24
}
26
25
27
- // GetCustomZone retrieves a cached custom zone
28
- func (c * DNSConfigCache ) GetCustomZone (key string ) (* proto.CustomZone , bool ) {
29
- if c == nil {
30
- return nil , false
31
- }
32
- if value , ok := c .CustomZones .Load (key ); ok {
33
- return value .(* proto.CustomZone ), true
34
- }
35
- return nil , false
36
- }
37
-
38
- // SetCustomZone stores a custom zone in the cache
39
- func (c * DNSConfigCache ) SetCustomZone (key string , value * proto.CustomZone ) {
40
- if c == nil {
41
- return
42
- }
43
- c .CustomZones .Store (key , value )
44
- }
45
-
46
26
// GetNameServerGroup retrieves a cached name server group
47
27
func (c * DNSConfigCache ) GetNameServerGroup (key string ) (* proto.NameServerGroup , bool ) {
48
28
if c == nil {
@@ -212,14 +192,8 @@ func toProtocolDNSConfig(update nbdns.Config, cache *DNSConfigCache) *proto.DNSC
212
192
}
213
193
214
194
for _ , zone := range update .CustomZones {
215
- cacheKey := zone .Domain
216
- if cachedZone , exists := cache .GetCustomZone (cacheKey ); exists {
217
- protoUpdate .CustomZones = append (protoUpdate .CustomZones , cachedZone )
218
- } else {
219
- protoZone := convertToProtoCustomZone (zone )
220
- cache .SetCustomZone (cacheKey , protoZone )
221
- protoUpdate .CustomZones = append (protoUpdate .CustomZones , protoZone )
222
- }
195
+ protoZone := convertToProtoCustomZone (zone )
196
+ protoUpdate .CustomZones = append (protoUpdate .CustomZones , protoZone )
223
197
}
224
198
225
199
for _ , nsGroup := range update .NameServerGroups {
0 commit comments