unmbt/ciallo-redis/cache does not have a README file

    RedisKey

    pub struct RedisKey[K, V] {
    prefix : String
    ttl_secs : Int?
    format_key : (K) -> String
    encode_val : (V) -> String
    decode_val : (String) -> V raise
    DataError

    }

    100% 无状态纯值 Schema-Safe 缓存键描述符:可安全在全局或局部构造;SingleFlight 托管在 RedisClient 内部按完整 Key 隔离防击穿

    RedisKey::delete

    async fn[K, V] RedisKey::delete(self : RedisKey[K, V], client :
    RedisClient
    , id : K) -> Unit raise
    DataError

    RedisKey::full_key

    fn[K, V] RedisKey::full_key(self : RedisKey[K, V], id : K) -> String

    RedisKey::get

    RedisKey::get_or_load

    async fn[K, V] RedisKey::get_or_load(self : RedisKey[K, V], client :
    RedisClient
    , id : K, ttl_secs? : Int, loader : async () -> V) -> V

    Cache-Aside 防击穿读取:未命中时经 RedisClient 内部 SingleFlight 按完整 Key 合并并发回源为 1 次 loader 调用

    RedisKey::json

    fn[K : Show, V :
    ToJson
    +
    FromJson
    ] RedisKey::json(prefix~ : String, ttl_secs? : Int) -> RedisKey[K, V]

    RedisKey::set

    async fn[K, V] RedisKey::set(self : RedisKey[K, V], client :
    RedisClient
    , id : K, value : V, ttl_secs? : Int) -> Unit raise
    DataError

    Source Files