+4
-4
Cargo.lock
+4
-4
Cargo.lock
···
2262
2263
[[package]]
2264
name = "jacquard"
2265
-
version = "0.9.3"
2266
dependencies = [
2267
"bytes",
2268
"clap",
···
2389
2390
[[package]]
2391
name = "jacquard-derive"
2392
-
version = "0.9.3"
2393
dependencies = [
2394
"heck 0.5.0",
2395
"inventory",
···
2432
2433
[[package]]
2434
name = "jacquard-lexgen"
2435
-
version = "0.9.3"
2436
dependencies = [
2437
"clap",
2438
"clap_complete",
···
2519
2520
[[package]]
2521
name = "jacquard-repo"
2522
-
version = "0.9.3"
2523
dependencies = [
2524
"anyhow",
2525
"bytes",
···
2262
2263
[[package]]
2264
name = "jacquard"
2265
+
version = "0.9.4"
2266
dependencies = [
2267
"bytes",
2268
"clap",
···
2389
2390
[[package]]
2391
name = "jacquard-derive"
2392
+
version = "0.9.4"
2393
dependencies = [
2394
"heck 0.5.0",
2395
"inventory",
···
2432
2433
[[package]]
2434
name = "jacquard-lexgen"
2435
+
version = "0.9.4"
2436
dependencies = [
2437
"clap",
2438
"clap_complete",
···
2519
2520
[[package]]
2521
name = "jacquard-repo"
2522
+
version = "0.9.4"
2523
dependencies = [
2524
"anyhow",
2525
"bytes",
+42
-41
crates/jacquard-identity/src/lib.rs
+42
-41
crates/jacquard-identity/src/lib.rs
···
100
use {
101
crate::lexicon_resolver::ResolvedLexiconSchema,
102
jacquard_common::{smol_str::SmolStr, types::string::Nsid},
103
-
std::time::Duration,
104
};
105
106
#[cfg(all(
···
110
use std::sync::Arc;
111
112
// Platform-specific cache implementations
113
-
#[cfg(all(feature = "cache", not(target_arch = "wasm32")))]
114
mod cache_impl {
115
/// Native: Use sync cache (thread-safe, no mutex needed)
116
pub type Cache<K, V> = mini_moka::sync::Cache<K, V>;
···
151
}
152
}
153
154
-
#[cfg(all(feature = "cache", target_arch = "wasm32"))]
155
-
mod cache_impl {
156
-
use std::sync::{Arc, Mutex};
157
158
-
/// WASM: Use unsync cache in Arc<Mutex<_>> (no threads, but need interior mutability)
159
-
pub type Cache<K, V> = Arc<Mutex<mini_moka::unsync::Cache<K, V>>>;
160
161
-
pub fn new_cache<K, V>(max_capacity: u64, ttl: std::time::Duration) -> Cache<K, V>
162
-
where
163
-
K: std::hash::Hash + Eq + 'static,
164
-
V: Clone + 'static,
165
-
{
166
-
Arc::new(Mutex::new(
167
-
mini_moka::unsync::Cache::builder()
168
-
.max_capacity(max_capacity)
169
-
.time_to_idle(ttl)
170
-
.build(),
171
-
))
172
-
}
173
174
-
pub fn get<K, V>(cache: &Cache<K, V>, key: &K) -> Option<V>
175
-
where
176
-
K: std::hash::Hash + Eq + 'static,
177
-
V: Clone + 'static,
178
-
{
179
-
cache.lock().unwrap().get(key).cloned()
180
-
}
181
182
-
pub fn insert<K, V>(cache: &Cache<K, V>, key: K, value: V)
183
-
where
184
-
K: std::hash::Hash + Eq + 'static,
185
-
V: Clone + 'static,
186
-
{
187
-
cache.lock().unwrap().insert(key, value);
188
-
}
189
190
-
pub fn invalidate<K, V>(cache: &Cache<K, V>, key: &K)
191
-
where
192
-
K: std::hash::Hash + Eq + 'static,
193
-
V: Clone + 'static,
194
-
{
195
-
cache.lock().unwrap().invalidate(key);
196
-
}
197
-
}
198
199
/// Configuration for resolver caching
200
#[cfg(feature = "cache")]
···
100
use {
101
crate::lexicon_resolver::ResolvedLexiconSchema,
102
jacquard_common::{smol_str::SmolStr, types::string::Nsid},
103
+
mini_moka::time::Duration,
104
};
105
106
#[cfg(all(
···
110
use std::sync::Arc;
111
112
// Platform-specific cache implementations
113
+
//#[cfg(all(feature = "cache", not(target_arch = "wasm32")))]
114
+
#[cfg(feature = "cache")]
115
mod cache_impl {
116
/// Native: Use sync cache (thread-safe, no mutex needed)
117
pub type Cache<K, V> = mini_moka::sync::Cache<K, V>;
···
152
}
153
}
154
155
+
// #[cfg(all(feature = "cache", target_arch = "wasm32"))]
156
+
// mod cache_impl {
157
+
// use std::sync::{Arc, Mutex};
158
159
+
// /// WASM: Use unsync cache in Arc<Mutex<_>> (no threads, but need interior mutability)
160
+
// pub type Cache<K, V> = Arc<Mutex<mini_moka::unsync::Cache<K, V>>>;
161
162
+
// pub fn new_cache<K, V>(max_capacity: u64, ttl: std::time::Duration) -> Cache<K, V>
163
+
// where
164
+
// K: std::hash::Hash + Eq + 'static,
165
+
// V: Clone + 'static,
166
+
// {
167
+
// Arc::new(Mutex::new(
168
+
// mini_moka::unsync::Cache::builder()
169
+
// .max_capacity(max_capacity)
170
+
// .time_to_idle(ttl)
171
+
// .build(),
172
+
// ))
173
+
// }
174
175
+
// pub fn get<K, V>(cache: &Cache<K, V>, key: &K) -> Option<V>
176
+
// where
177
+
// K: std::hash::Hash + Eq + 'static,
178
+
// V: Clone + 'static,
179
+
// {
180
+
// cache.lock().unwrap().get(key).cloned()
181
+
// }
182
183
+
// pub fn insert<K, V>(cache: &Cache<K, V>, key: K, value: V)
184
+
// where
185
+
// K: std::hash::Hash + Eq + 'static,
186
+
// V: Clone + 'static,
187
+
// {
188
+
// cache.lock().unwrap().insert(key, value);
189
+
// }
190
191
+
// pub fn invalidate<K, V>(cache: &Cache<K, V>, key: &K)
192
+
// where
193
+
// K: std::hash::Hash + Eq + 'static,
194
+
// V: Clone + 'static,
195
+
// {
196
+
// cache.lock().unwrap().invalidate(key);
197
+
// }
198
+
// }
199
200
/// Configuration for resolver caching
201
#[cfg(feature = "cache")]
+1
crates/jacquard-oauth/src/resolver.rs
+1
crates/jacquard-oauth/src/resolver.rs
···
5
use http::{Request, StatusCode};
6
use jacquard_common::CowStr;
7
use jacquard_common::IntoStatic;
8
+
use jacquard_common::cowstr::ToCowStr;
9
use jacquard_common::types::did_doc::DidDocument;
10
use jacquard_common::types::ident::AtIdentifier;
11
use jacquard_common::{http_client::HttpClient, types::did::Did};
+1
-1
crates/mini-moka-vendored/src/common.rs
+1
-1
crates/mini-moka-vendored/src/common.rs
+2
-5
crates/mini-moka-vendored/src/common/concurrent/housekeeper.rs
+2
-5
crates/mini-moka-vendored/src/common/concurrent/housekeeper.rs
+5
-1
crates/mini-moka-vendored/src/common/time.rs
+5
-1
crates/mini-moka-vendored/src/common/time.rs
+2
crates/mini-moka-vendored/src/lib.rs
+2
crates/mini-moka-vendored/src/lib.rs
+1
-2
crates/mini-moka-vendored/src/sync/base_cache.rs
+1
-2
crates/mini-moka-vendored/src/sync/base_cache.rs
+1
-2
crates/mini-moka-vendored/src/sync/builder.rs
+1
-2
crates/mini-moka-vendored/src/sync/builder.rs
···
1
use super::Cache;
2
-
use crate::{common::builder_utils, common::concurrent::Weigher};
3
4
use std::{
5
collections::hash_map::RandomState,
6
hash::{BuildHasher, Hash},
7
marker::PhantomData,
8
sync::Arc,
9
-
time::Duration,
10
};
11
12
/// Builds a [`Cache`][cache-struct] or with various configuration knobs.
···
1
use super::Cache;
2
+
use crate::{common::builder_utils, common::concurrent::Weigher, common::time::Duration};
3
4
use std::{
5
collections::hash_map::RandomState,
6
hash::{BuildHasher, Hash},
7
marker::PhantomData,
8
sync::Arc,
9
};
10
11
/// Builds a [`Cache`][cache-struct] or with various configuration knobs.
+1
-1
crates/mini-moka-vendored/src/sync/cache.rs
+1
-1
crates/mini-moka-vendored/src/sync/cache.rs
+1
-1
examples/app_password_create_post.rs
+1
-1
examples/app_password_create_post.rs