mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-01 01:18:34 +00:00
* refactor(cache): remove experimental Redis and v2 caches * fix(proxy): use handled exception for follow-up cost --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
25 lines
653 B
Rust
25 lines
653 B
Rust
use std::{sync::Arc, time::Duration};
|
|
|
|
use litellm_cache_memory::InMemoryCache;
|
|
use litellm_cache_response::{CacheEntry, CacheKeyInput, ResponseCache, ResponseCacheRequest};
|
|
use rstest::fixture;
|
|
|
|
#[fixture]
|
|
pub fn memory() -> Arc<ResponseCache<InMemoryCache<CacheEntry>>> {
|
|
Arc::new(ResponseCache::new(Arc::new(InMemoryCache::new(
|
|
Some(8),
|
|
Some(Duration::from_secs(600)),
|
|
))))
|
|
}
|
|
|
|
#[fixture]
|
|
pub fn request() -> ResponseCacheRequest {
|
|
keyed("tenant:key")
|
|
}
|
|
|
|
pub fn keyed(key: &str) -> ResponseCacheRequest {
|
|
ResponseCacheRequest::new(CacheKeyInput {
|
|
preset: Some(key.into()),
|
|
..Default::default()
|
|
})
|
|
}
|