implement clear_cache() for resolver service
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
9ce95a7030
commit
8010505853
3 changed files with 27 additions and 1 deletions
|
@ -6,6 +6,7 @@ mod tests;
|
|||
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use conduwuit::{Result, Server, arrayvec::ArrayString, utils::MutexMap};
|
||||
|
||||
use self::{cache::Cache, dns::Resolver};
|
||||
|
@ -26,6 +27,7 @@ struct Services {
|
|||
type Resolving = MutexMap<NameBuf, ()>;
|
||||
type NameBuf = ArrayString<256>;
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
#[allow(clippy::as_conversions, clippy::cast_sign_loss, clippy::cast_possible_truncation)]
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
|
@ -41,5 +43,10 @@ impl crate::Service for Service {
|
|||
}))
|
||||
}
|
||||
|
||||
async fn clear_cache(&self) {
|
||||
self.resolver.clear_cache();
|
||||
self.cache.clear().await;
|
||||
}
|
||||
|
||||
fn name(&self) -> &str { crate::service::make_name(std::module_path!()) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue