namespace DG.Redis
{
///
/// Redis manage interface
///
public interface IRedisManager
{
///
/// Redis connection
///
///
void RedisConnection(string name, string connStr, int DefaultDatabase);
///
/// Get database
///
///
IDatabase GetDatabase(string name = "");
///
/// Add a new entity
///
/// Entity
/// Key
/// Entity
/// Cache time
///
bool Set(string key, TEntity entity, TimeSpan? cacheTime = null, string name = "");
///
/// Add a new array
///
/// Entity
/// Key
/// An array
/// Cache time
///
bool Set(string key, TEntity[] entities, TimeSpan? cacheTime = null, string name = "");
///
/// Add a new list
///
/// Entity
/// Key
/// An list
/// Cache time
///
bool Set(string key, List entities, TimeSpan? cacheTime = null, string name = "");
///
/// Add a new entity
///
/// Entity
/// Key
/// Entity
/// Cache time
///
Task SetAsync(string key, TEntity entity, TimeSpan? cacheTime = null, string name = "");
///
/// Add a new array
///
/// Entity
/// Key
/// An array
/// Cache time
///
Task SetAsync(string key, TEntity[] entities, TimeSpan? cacheTime = null, string name = "");
///
/// Add a new list
///
/// entity
/// key
/// a list
/// cache time
///
Task SetAsync(string key, List entities, TimeSpan? cacheTime = null, string name = "");
///
/// Get list tatal
///
/// Key
///
long Count(string key, string name = "");
///
/// Get list tatal
///
/// Key
///
Task CountAsync(string key, string name = "");
///
/// 判断在缓存中是否存在该key的缓存数据
///
///
///
bool Exists(string key, string name = "");
///
/// 判断是否存在
///
///
///
Task ExistsAsync(string key, string name = "");
///
/// Set cache time
///
/// Key
/// Cache time
///
bool Expire(string key, TimeSpan cacheTime, string name = "");
///
/// Set cache time
///
/// Key
/// Cache time
///
///
Task ExpireAsync(string key, TimeSpan cacheTime, string name = "");
///
/// Remove by key
///
/// Key
///
bool Remove(string key, string name = "");
///
/// Remove by key array
///
/// Key array
///
bool Remove(string[] keys, string name = "");
///
/// Remove by key list
///
/// Key list
///
bool Remove(List keys, string name = "");
///
/// Remove by key
///
/// Key
///
Task RemoveAsync(string key, string name = "");
///
/// Remove by key array
///
/// Key array
///
Task RemoveAsync(string[] keys, string name = "");
///
/// Remove by key list
///
/// Key list
///
Task RemoveAsync(List keys, string name = "");
///
/// Blocking Dequeue
///
///
///
TEntity BlockingDequeue(string key, string name = "");
///
/// Blocking Dequeue
///
///
///
Task BlockingDequeueAsync(string key, string name = "");
///
/// Dequeue entity
///
///
///
///
TEntity Dequeue(string key, string name = "");
///
/// Dequeue entity
///
///
///
///
Task DequeueAsync(string key, string name = "");
///
/// Enqueue entity
///
///
///
void Enqueue(string key, TEntity entity, string name = "");
///
/// Enqueue entity
///
///
///
Task EnqueueAsync(string key, TEntity entity, string name = "");
///
/// Increment
///
///
///
/// 三种命令模式
/// Sync,同步模式会直接阻塞调用者,但是显然不会阻塞其他线程。
/// Async,异步模式直接走的是Task模型。
/// Fire - and - Forget,就是发送命令,然后完全不关心最终什么时候完成命令操作。
/// 即发即弃:通过配置 CommandFlags 来实现即发即弃功能,在该实例中该方法会立即返回,如果是string则返回null 如果是int则返回0.这个操作将会继续在后台运行,一个典型的用法页面计数器的实现:
///
///
long Increment(string key, string name = "");
///
/// Increment
///
///
///
Task IncrementAsync(string key, string name = "");
///
/// Decrement
///
///
///
///
long Decrement(string key, string value, string name = "");
///
/// Decrement
///
///
///
///
Task DecrementAsync(string key, string value, string name = "");
///
/// Get an entity
///
///
///
///
TEntity Get(string key, string name = "");
///
/// Get an list
///
///
///
///
List GetList(string key, string name = "");
///
/// Get an array
///
///
///
///
TEntity[] GetArray(string key, string name = "");
///
/// Get an entity
///
///
///
///
Task GetAsync(string key, string name = "");
Task GetHashAsync(string key, string name = "");
///
/// Get an list
///
///
///
///
Task> GetListAsync(string key, string name = "");
///
/// Get an array
///
///
///
///
Task GetArrayAsync(string key, string name = "");
}
}