MCPcopy Create free account
hub / github.com/Effect-TS/effect / eval_

Function eval_

packages/effect/src/unstable/persistence/Redis.ts:63–86  ·  view source on GitHub ↗
(
    script: Script<Config>
  )

Source from the content-addressed store, hash-verified

61 )
62
63 const eval_ = <
64 Config extends {
65 readonly params: ReadonlyArray<unknown>
66 readonly result: unknown
67 }
68 >(
69 script: Script<Config>
70 ) =>
71 (...params: Config["params"]): Effect.Effect<Config["result"], RedisError> => {
72 const evalSha = (sha: string) =>
73 options.send<Config["result"]>(
74 "EVALSHA",
75 sha,
76 script.numberOfKeys(...params).toString(),
77 ...script.params(...params).map((param) => String(param))
78 )
79 return Cache.get(scriptCache, script).pipe(
80 Effect.flatMap(evalSha),
81 Effect.catchIf(
82 (error) => String(error.cause).includes("NOSCRIPT"),
83 () => Cache.refresh(scriptCache, script).pipe(Effect.flatMap(evalSha))
84 )
85 )
86 }
87
88 return identity<Redis["Service"]>({
89 send: options.send,

Callers

nothing calls this directly

Calls 4

refreshMethod · 0.80
pipeMethod · 0.65
getMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected