KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
resolver_cache.h
Go to the documentation of this file.
1
12#ifndef KEEL_RESOLVER_CACHE_H
13#define KEEL_RESOLVER_CACHE_H
14
15#include <stdint.h>
16#include <keel/allocator.h>
17#include <keel/resolver.h>
18
19#define KL_RESCACHE_DEFAULT_TTL_MS 60000
20#define KL_RESCACHE_DEFAULT_CAPACITY 64
21
22typedef struct {
23 uint64_t ttl_ms;
26
40 const KlResolverCacheConfig *cfg,
41 KlAllocator *alloc);
42
47
52
53#endif /* KEEL_RESOLVER_CACHE_H */
KlResolver * kl_resolver_cache_create(KlResolver *inner, const KlResolverCacheConfig *cfg, KlAllocator *alloc)
Create a caching resolver that wraps an inner resolver.
int kl_resolver_cache_count(const KlResolver *resolver)
Return the number of occupied cache entries.
void kl_resolver_cache_clear(KlResolver *resolver)
Evict all cached entries.
Bring-your-own allocator vtable.
Definition allocator.h:12
Definition resolver_cache.h:22
uint64_t ttl_ms
Definition resolver_cache.h:23
int capacity
Definition resolver_cache.h:24
Async DNS resolver vtable.
Definition resolver.h:40