Edit on GitHub

ServiceStack.Redis on .NET Core

Documentation for ServiceStack.Redis can be found on ServiceStack.Redis Project Page.

The ServiceStack.Redis NuGet package supports both .NET Framework and .NET Core Applications:

$ dotnet add package ServiceStack.Redis

Use ServiceStack.Redis.Core instead if you’re running ASP.NET Core Apps on the .NET Framework

PM> Install-Package ServiceStack.Redis.Core

Basic Example

using System;
using ServiceStack.Redis;

namespace MyApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var manager = new RedisManagerPool("localhost:6379");
            using (var client = manager.GetClient())
            {
                client.Set("foo", "bar");
                Console.WriteLine("foo={0}", client.Get<string>("foo"));
            }
        }
    }
}

Then hit “run” button (F5). You should get following output:

Output

Run ServiceStack.Redis on Linux

Install .NET Core

Suppose that you have Ubuntu 19.10 installed (to see installation instructions for other OS you can visit .NET Core site. Run commands in the console:

Register Microsoft key and feed

wget https://packages.microsoft.com/config/ubuntu/19.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb    

Install the .NET Core SDK

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1