use std::collections::HashMap;
use std::time::{Duration, Instant};
pub fn memoize_with_ttl<Args, Result, F>(_f: F, _cache_lifetime_ms: u64) -> impl Fn(Args) -> Result
where
Args: Clone + std::fmt::Debug + 'static,
Result: Clone + 'static,
F: Fn(Args) -> Result + 'static,
{
move |arg: Args| {
let key = format!("{:?}", arg);
let _ = key; unimplemented!("memoize_with_ttl not fully implemented")
}
}
pub fn memoize_with_ttl_async<Args, Result, F, Fut>(
_f: F,
_cache_lifetime_ms: u64,
) -> impl Fn(Args) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result> + Send>>
where
Args: Clone + std::fmt::Debug + Send + 'static,
Result: Clone + Send + 'static,
F: Fn(Args) -> Fut + 'static,
Fut: std::future::Future<Output = Result> + Send,
{
move |_arg: Args| {
Box::pin(async { unimplemented!("memoize_with_ttl_async not fully implemented") })
}
}
pub fn memoize_with_lru<Args, Result, K, F>(
f: F,
_cache_fn: impl Fn(&Args) -> K,
_max_cache_size: usize,
) -> impl Fn(Args) -> Result
where
Args: std::fmt::Debug,
Result: Clone,
K: std::hash::Hash + Eq,
F: Fn(Args) -> Result,
{
move |arg: Args| f(arg)
}