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:

<PackageReference Include="ServiceStack.Redis" Version="8.*" />

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

<PackageReference Include="ServiceStack.Redis.Core" Version="8.*" />

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