use rs_zero::cache::{CacheKey, CacheStore, MemoryCacheStore};
#[cfg(feature = "cache-redis")]
use rs_zero::cache_redis::{RedisCacheConfig, RedisCacheStore};
#[tokio::test]
async fn memory_cache_covers_json_namespace_and_ttl() {
let key = CacheKey::new("app", ["user", "1"]);
let memory = MemoryCacheStore::new();
memory
.set_json(&key, &serde_json::json!({"name":"Ada"}), None)
.await
.expect("set");
let value: serde_json::Value = memory.get_json(&key).await.expect("get").expect("value");
assert_eq!(value["name"], "Ada");
}
#[cfg(feature = "cache-redis")]
#[tokio::test]
async fn redis_facade_is_testable_without_external_service() {
let redis = RedisCacheStore::new(RedisCacheConfig::default());
redis.health_check().await.expect("health");
}