So I’m using Deno for my server and I want to persist some data in a Redis database, how can I do it?
I tried to follow this documentation (https://deno.land/x/redis) but didn’t quite understand, I know Redis offers a lot of services, and this is my first time using it, so I’m a little confused
2
Answers
use
connect
to connect to your Redis server. Then use.set
method to set a value, equivalent to redis command:And use
.get
to retrieve the value, which is equivalent to redis command:Run the script using
--allow-net
flag:Make sure if you get
Uncaught PermissionDenied: network access to "127.0.0.1:6379", run again with the --allow-net flag
privilege error, you are missing--allow-net
flag while running.