2017-04-13 23:20:05 +02:00
|
|
|
|
using System;
|
|
|
|
|
using StackExchange.Redis;
|
|
|
|
|
|
2017-05-06 20:35:31 +02:00
|
|
|
|
namespace Geekbot.net.Lib.IClients
|
2017-04-13 23:20:05 +02:00
|
|
|
|
{
|
2017-04-14 21:36:01 +02:00
|
|
|
|
public interface IRedisClient
|
2017-04-13 23:20:05 +02:00
|
|
|
|
{
|
2017-04-14 21:36:01 +02:00
|
|
|
|
IDatabase Client { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sealed class RedisClient : IRedisClient
|
|
|
|
|
{
|
|
|
|
|
public RedisClient()
|
2017-04-13 23:20:05 +02:00
|
|
|
|
{
|
2017-04-17 12:55:20 +02:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var redis = ConnectionMultiplexer.Connect("127.0.0.1:6379");
|
2017-04-18 14:08:56 +02:00
|
|
|
|
Client = redis.GetDatabase(6);
|
2017-04-17 12:55:20 +02:00
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
2017-04-13 23:20:05 +02:00
|
|
|
|
{
|
2017-04-18 11:00:38 +02:00
|
|
|
|
Console.WriteLine("Start Redis pls...");
|
|
|
|
|
Environment.Exit(1);
|
2017-04-13 23:20:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-14 21:36:01 +02:00
|
|
|
|
|
|
|
|
|
public IDatabase Client { get; set; }
|
2017-04-13 23:20:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|