Skip to content

Conversation

richfitz
Copy link
Owner

@richfitz richfitz commented Oct 10, 2024

This PR adds an experimental and subject-to-change interface to the low level redis commands to control how string conversion happens, to address #60. You can run any redis command by using the lower level interface:

con <- hiredis()
con$command(list("PING"))
#> [Redis: PONG]

So we can already set data this way:

con$command(list("SET", "key", "value")) # same as con$SET("key", "value"))
#> [Redis: OK]

and get data this way:

con$command(list("GET", "key")) # same as con$GET("key")
#> [1] "value"

The new feature added in this PR is a 3rd argument to $command, as, which is a string taking values auto (the current behaviour) or raw (the default NULL is equivalent to auto). In action:

con$command(list("GET", "key"), "raw")
#> [1] 76 61 6c 75 65

@richfitz richfitz marked this pull request as draft October 10, 2024 17:54
@richfitz richfitz changed the title Experimental Experimental conversion control Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant