feat(labrinth): Redis Cluster (#6771)

* chore(labrinth): bump to redis 1.4.1

* feat(labrinth): redis cluster

* chore: cleanup

* feat(labrinth): cache locking

* fix(labrinth): clippy

* chore(labrinth): cleanup env, remove postcard support

* chore(ci): fix test env for labrinth

* chore(labrinth): bump all key versions

* chore(labrinth): improve redis key identities handling

* chore(labrinth): simplify deadline handling

* chore(labrinth): remove unused lease tracking

* chore(labrinth): remove distributed cache locking for now

* chore(labrinth): improve redis backend init error

* feat(labrinth): expose redis read replica strategy

* chore(ci): remove other connection mode tests

* chore: split xredis crate

* feat(xredis): primaries routing

* chore: tombi fmt

* chore: clippy

* chore: update query cache
This commit is contained in:
François-Xavier Talbot
2026-07-23 11:35:02 +02:00
committed by GitHub
parent 11af2651ef
commit b4d681e713
146 changed files with 4741 additions and 2000 deletions
@@ -1,15 +1,15 @@
use crate::database::models::{
DBProductId, DBProductPriceId, DatabaseError, product_item,
};
use crate::database::redis::RedisPool;
use crate::models::billing::{Price, ProductMetadata};
use dashmap::DashMap;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use std::convert::TryInto;
use xredis::RedisPool;
const PRODUCTS_NAMESPACE: &str = "products:v1";
const PRODUCTS_NAMESPACE: &str = "products:v3";
pub struct DBProduct {
pub id: DBProductId,
@@ -152,9 +152,10 @@ impl QueryProductWithPrices {
{
{
let mut redis = redis.connect().await?;
let key = redis.key().metadata(PRODUCTS_NAMESPACE, "all");
let res: Option<Vec<QueryProductWithPrices>> =
redis.get_deserialized(PRODUCTS_NAMESPACE, "all").await?;
redis.get_deserialized(&key).await?;
if let Some(res) = res {
return Ok(res);
@@ -193,10 +194,9 @@ impl QueryProductWithPrices {
.collect::<Vec<_>>();
let mut redis = redis.connect().await?;
let key = redis.key().metadata(PRODUCTS_NAMESPACE, "all");
redis
.set_serialized(PRODUCTS_NAMESPACE, "all", &products, None)
.await?;
redis.set_serialized(&key, &products, None).await?;
Ok(products)
}