using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BP.Difference.Redis
{
public abstract class RedisOperatorBase : IDisposable
{
protected IRedisClient Redis { get; private set; }
private bool _disposed = false;
protected RedisOperatorBase()
{
RedisManager redisManager = new RedisManager();
Redis = redisManager.GetClient();
}
public void Dispose(bool disposing)
{
if (!this._disposed)
{
if (disposing)
{
Redis.Dispose();
Redis = null;
}
}
this._disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
///
/// 保存数据DB文件到硬盘
///
public void Save()
{
Redis.Save();
}
///
/// 异步保存数据DB文件到硬盘
///
public void SaveAsync()
{
Redis.SaveAsync();
}
}
}