Skip to content

Instantly share code, notes, and snippets.

@TSKGunGun
Created December 14, 2016 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TSKGunGun/55e0f1698885faa7adff2f9a154aa060 to your computer and use it in GitHub Desktop.
Save TSKGunGun/55e0f1698885faa7adff2f9a154aa060 to your computer and use it in GitHub Desktop.
StackExchange.Redis Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StackExchange.Redis;
namespace Redis_CSharp_Sample
{
class Program
{
static void Main(string[] args)
{
//Connect
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();
string value = "abcdefg";
db.StringSet("mykey", value);
Console.WriteLine("Set Value : " + value); //writes: "abcdefg"
Console.WriteLine("Get Value : " + db.StringGet("mykey") + "\n" );
Console.WriteLine("何かキーを押してください...");
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment