Effect CommunityEC
Effect Community9mo ago
4 replies
Huge Letters

Config provider caching

const IntStringSchema = Schema.NumberFromString.pipe(
    Schema.transform(Integer, {
        decode(z) {
            console.log("config");
            return z;
        },
        encode: identity,
    }),
);
const PORT = Schema.Config("PORT", IntStringSchema);


if i yieldPORT twice - i can see that decode is being called twice. I get that config is not necessarily static and can be provided locally to some effects so it shouldnt really be cached - but parsing the whole config each time i access it seems excessive

how can I enable config caching? should I create a service from my config schema and access the service instead since global services are cached by default?
Was this page helpful?