Skip to content

Instantly share code, notes, and snippets.

@hdknr
Last active October 12, 2024 10:01
Show Gist options
  • Select an option

  • Save hdknr/ecf1cb51339d7447a19e to your computer and use it in GitHub Desktop.

Select an option

Save hdknr/ecf1cb51339d7447a19e to your computer and use it in GitHub Desktop.
Redis Windows

Redis-64 on Windows

Install

C:\Users\hdknr>choco install redis-64
Chocolatey v0.9.9.2
Installing the following packages:
redis-64
By installing you accept licenses for the packages.

redis-64 v2.8.19
 ShimGen has successfully created a shim for redis-benchmark.exe
 ShimGen has successfully created a shim for redis-check-aof.exe
 ShimGen has successfully created a shim for redis-check-dump.exe
 ShimGen has successfully created a shim for redis-cli.exe
 ShimGen has successfully created a shim for redis-server.exe
 redis-64 has been installed successfully.

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details.

redis-server

C:\Users\hdknr>redis-server
[7308] 21 Apr 10:26:02.432 # Warning: no config file specified, using the defaul
t config. 
In order to specify a config file use C:\ProgramData\chocolatey\lib\redis-64\redis-server.exe /path/to/redis.conf
               _._
          _.-``__ ''-._
     _.-``    `.  `_.  ''-._           Redis 2.8.19 (00000000/0) 64 bit
 .-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-`  | `,    )     Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 7308
 `-._    `-._  `-./  _.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |           http://redis.io
 `-._    `-._`-.__.-'_.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |
 `-._    `-._`-.__.-'_.-'    _.-'
     `-._    `-.__.-'    _.-'
         `-._        _.-'
             `-.__.-'

[7308] 21 Apr 10:26:02.455 # Server started, Redis version 2.8.19
[7308] 21 Apr 10:26:02.456 * The server is now ready to accept connections on port 6379

redis-cli

C:\Users\hdknr>redis-cli
127.0.0.1:6379> set testkey  testvalue
OK
127.0.0.1:6379> get testkey
"testvalue"
127.0.0.1:6379>

StackExchange.Redis

PM> Install-Package StackExchange.Redis
  • Windows Forms
        private void button1_Click(object sender, EventArgs e)
        {
            var connect = StackExchange.Redis.ConnectionMultiplexer.Connect("localhost");
            var cb = connect.GetDatabase();  // StackExchange.Redis.IDatabase

            cb.StringSet("name", "hdknr");
            MessageBox.Show(cb.StringGet("name"));
        }
  • Console Client
127.0.0.1:6379> get name
"hdknr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment