添加授权缓存
This commit is contained in:
parent
776d81cda2
commit
4f58c3e3e6
17
library/src/core/auth_cache.rs
Normal file
17
library/src/core/auth_cache.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use std::sync::OnceLock;
|
||||
use moka::future::Cache;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! auth_cache {
|
||||
() => {
|
||||
library::core::auth_cache::init_auth_cache()
|
||||
};
|
||||
}
|
||||
|
||||
static AUTH_CACHE: OnceLock<Cache<String, String>> = OnceLock::new();
|
||||
|
||||
fn init_auth_cache() -> &'static Cache<String, String> {
|
||||
AUTH_CACHE.get_or_init(|| {
|
||||
Cache::new(1000)
|
||||
})
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
use moka::future::Cache;
|
||||
|
||||
|
||||
// use std::collections::HashMap;
|
||||
// use moka::future::Cache;
|
||||
//
|
||||
//
|
||||
// use std::any::{Any, TypeId};
|
||||
// use std::collections::HashMap;
|
||||
// use std::lazy::SyncLazy;
|
||||
|
@ -2,3 +2,4 @@ pub mod config;
|
||||
pub mod logger;
|
||||
pub mod db;
|
||||
pub mod local_cache;
|
||||
pub mod auth_cache;
|
||||
|
Loading…
Reference in New Issue
Block a user