Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental conversion control #61

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Experimental conversion control #61

wants to merge 3 commits into from

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