Closed mitjafelicijan closed 2 years ago
What happens with:
{.gcsafe.}:
let info = rds.hGetAll("somekey")
If I do it like you suggested, it works. Is there a way to use this globally, or is this not recommended?
Some procedures
in this library is not per se marked as gcsafe
. See the PR #25.
When using {.gcsafe.}
you manually tell the compiler, that the code is safe - so you gotta be sure, that it is safe!
To override the compiler's gcsafety analysis a {.gcsafe.} pragma block can be used
https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect
You can mark a whole procedure
with:
proc redisproc() {.gcsafe.} =
xxxx
Can I use {.gcsafe}
with {.async}
?
If I try this proc databaseInfo*(ctx: context.Context) {.gcsafe.} {.async.} =
I get indentation error.
It works like this
Is this the only way of using it in my case?
You can combine multiple pragmas. Just separate them with ,
.
proc databaseInfo*(ctx: context.Context) {.async,gcsafe.} =
xxx
If I populate with
setk
and then dolet info = rds.get("somekey")
this works ok.But if these key is populated with
hMSet
(which works) and then I try to get data from withlet info = rds.hGetAll("somekey")
the whole thing fails with the following error.