feat: improve performance of DNSCache backend (#1415) · python-zeroconf/python-zeroconf@1df2e69
@@ -13,9 +13,12 @@ from ._dns cimport (
131314141515cdef object _UNIQUE_RECORD_TYPES
16-cdef object _TYPE_PTR
16+cdef unsigned int _TYPE_PTR
1717cdef cython.uint _ONE_SECOND
181819+@cython.locals(
20+record_cache=dict,
21+)
1922cdef _remove_key(cython.dict cache, object key, DNSRecord record)
20232124@@ -42,7 +45,7 @@ cdef class DNSCache:
4245records=cython.dict,
4346record=DNSRecord,
4447 )
45- cpdef list async_all_by_details(self, str name, object type_, object class_)
48+ cpdef list async_all_by_details(self, str name, unsigned int type_, unsigned int class_)
46494750 cpdef cython.dict async_entries_with_name(self, str name)
4851@@ -51,23 +54,35 @@ cdef class DNSCache:
5154@cython.locals(
5255cached_entry=DNSRecord,
5356 )
54- cpdef DNSRecord get_by_details(self, str name, object type_, object class_)
57+ cpdef DNSRecord get_by_details(self, str name, unsigned int type_, unsigned int class_)
55585659@cython.locals(
5760records=cython.dict,
5861entry=DNSRecord,
5962 )
60- cpdef cython.list get_all_by_details(self, str name, object type_, object class_)
63+ cpdef cython.list get_all_by_details(self, str name, unsigned int type_, unsigned int class_)
61646265@cython.locals(
6366store=cython.dict,
67+service_record=DNSService
6468 )
6569 cdef bint _async_add(self, DNSRecord record)
667071+@cython.locals(
72+service_record=DNSService
73+ )
6774 cdef void _async_remove(self, DNSRecord record)
68756976@cython.locals(
7077record=DNSRecord,
7178created_double=double,
7279 )
7380 cpdef void async_mark_unique_records_older_than_1s_to_expire(self, cython.set unique_types, object answers, double now)
81+82+ cpdef entries_with_name(self, str name)
83+84+@cython.locals(
85+record=DNSRecord,
86+now=double
87+ )
88+ cpdef current_entry_with_name_and_alias(self, str name, str alias)