add: redis cache support

This commit is contained in:
trisua 2025-03-23 21:19:16 -04:00
parent 1d9a96ae69
commit 38dbf10130
13 changed files with 541 additions and 17 deletions

View file

@ -12,10 +12,10 @@ pub fn unix_epoch_timestamp() -> u128 {
}
/// Get a [`i64`] timestamp from the given `year` epoch
pub fn epoch_timestamp(year: i32) -> i64 {
pub fn epoch_timestamp(year: u32) -> i64 {
let now = Utc::now().timestamp_millis();
let then = Utc
.with_ymd_and_hms(year, 1, 1, 0, 0, 0)
.with_ymd_and_hms(year as i32, 1, 1, 0, 0, 0)
.unwrap()
.timestamp_millis();