Skip to content

Commit

Permalink
Fix full backward compatibility with private API
Browse files Browse the repository at this point in the history
  • Loading branch information
AJIOB committed Feb 13, 2024
1 parent 0b661dc commit 2131617
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ pub fn storage_from_config(
#[cfg(feature = "redis")]
CacheType::Redis(config::RedisCacheConfig {
ref url,
expiration: ref ttl,
ref ttl,
ref key_prefix,
}) => {
debug!("Init redis cache with url {url}");
Expand Down
14 changes: 7 additions & 7 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ pub struct RedisCacheConfig {
/// the ttl (expiration) time in seconds.
///
/// Default to infinity (0)
#[serde(default)]
pub expiration: u64,
#[serde(default, alias = "expiration")]
pub ttl: u64,

#[serde(default)]
pub key_prefix: String,
Expand Down Expand Up @@ -628,7 +628,7 @@ fn config_from_env() -> Result<EnvConfig> {
};
let redis = env::var("SCCACHE_REDIS").ok().map(|url| RedisCacheConfig {
url,
expiration: ttl,
ttl,
key_prefix: String::new(),
});

Expand Down Expand Up @@ -1201,7 +1201,7 @@ fn config_overrides() {
}),
redis: Some(RedisCacheConfig {
url: "myotherredisurl".to_owned(),
expiration: 24 * 3600,
ttl: 24 * 3600,
key_prefix: String::new(),
}),
..Default::default()
Expand All @@ -1223,7 +1223,7 @@ fn config_overrides() {
}),
redis: Some(RedisCacheConfig {
url: "myredisurl".to_owned(),
expiration: 24 * 3600,
ttl: 24 * 3600,
key_prefix: String::new(),
}),
..Default::default()
Expand All @@ -1237,7 +1237,7 @@ fn config_overrides() {
Config {
cache: Some(CacheType::Redis(RedisCacheConfig {
url: "myotherredisurl".to_owned(),
expiration: 24 * 3600,
ttl: 24 * 3600,
key_prefix: String::new(),
}),),
fallback_cache: DiskCacheConfig {
Expand Down Expand Up @@ -1457,7 +1457,7 @@ no_credentials = true
}),
redis: Some(RedisCacheConfig {
url: "redis://user:passwd@1.2.3.4:6379/1".to_owned(),
expiration: 24 * 3600,
ttl: 24 * 3600,
key_prefix: "/my/redis/cache".into(),
}),
memcached: Some(MemcachedCacheConfig {
Expand Down

0 comments on commit 2131617

Please sign in to comment.