125 lines
3.1 KiB
C#
125 lines
3.1 KiB
C#
|
|
using NewLife.Caching;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace RedisHelper
|
|
{
|
|
public interface ICache
|
|
{
|
|
FullRedis GetFullRedis();
|
|
|
|
void StartPipeline();
|
|
|
|
T Get<T>(string key);
|
|
|
|
IDictionary<string, T> GetAll<T>(List<string> keys);
|
|
int Remove(string key);
|
|
void Clear();
|
|
|
|
|
|
|
|
void Clear(string pattern, int count = 1000);
|
|
|
|
bool Insert<T>(string key, T data);
|
|
|
|
|
|
bool Insert<T>(string key, T data, int expireSeconds);
|
|
|
|
|
|
bool Insert<T>(string key, T data, TimeSpan expireSeconds);
|
|
|
|
|
|
long IncrBy(string key, long value);
|
|
|
|
bool SetAdd<T>(string key, T value);
|
|
|
|
bool SetContains<T>(string key, T value);
|
|
|
|
bool SetRemove<T>(string key, T value);
|
|
|
|
long SetCount(string key);
|
|
|
|
List<T> SetMembers<T>(string key);
|
|
|
|
bool InitDataToList<T>(string key, List<T> t);
|
|
|
|
|
|
|
|
IEnumerable<string> GetPatternKey(string pattern, int count = 1000);
|
|
|
|
|
|
IEnumerable<T> GetPatternList<T>(string pattern, int count = 1000);
|
|
|
|
bool UpdateDataToList<T>(string key, T t, Func<T, bool> predicate);
|
|
|
|
bool Exists(string key);
|
|
|
|
bool AddToList<T>(string key, T t);
|
|
|
|
bool RemoveFromList<T>(string key, Func<T, bool> predicate);
|
|
|
|
|
|
IList<T> GetList<T>(string key);
|
|
|
|
|
|
bool InitDataToDictionary<T>(string key, IDictionary<string, T> t);
|
|
|
|
|
|
bool UpdateDataToDictionary<T>(string key, T t, string dataKey);
|
|
|
|
|
|
bool RemoveFromDictionary<T>(string key, string dataKey);
|
|
|
|
Tuple<IEnumerable<T>,int> GetPageDescendingListFromDictionary<T, Tkey>(string key, int pageIndex, int pageSize,
|
|
Func<T, bool> filter,
|
|
Func<T, Tkey> sort);
|
|
|
|
Tuple<IEnumerable<T>, int> GetPageDescendingListFromDictionary<T, Tkey>(string key, int pageIndex,
|
|
int pageSize, Func<T, bool> filter,
|
|
Func<T, Tkey> sort, int skipCount);
|
|
|
|
Tuple<IEnumerable<T>,int> GetPageListFromDictionary<T, Tkey>(string key, int pageIndex, int pageSize,
|
|
Func<T, bool> filter,
|
|
Func<T, Tkey> sort);
|
|
|
|
Tuple<IEnumerable<T>,int> GetPageListFromDictionary<T, Tkey>(string key, int pageIndex, int pageSize,
|
|
Func<T, bool> filter,
|
|
Func<T, Tkey> sort, int skipCount);
|
|
|
|
|
|
|
|
IEnumerable<T> GetListFromDictionary<T, Tkey>(string key, int pageIndex, int pageSize,
|
|
Func<T, bool> filter,
|
|
Func<T, Tkey> sort);
|
|
|
|
|
|
IEnumerable<T> GetDescendingListFromDictionary<T, Tkey>(string key, int pageIndex, int pageSize,
|
|
Func<T, bool> filter,
|
|
Func<T, Tkey> sort);
|
|
|
|
|
|
|
|
|
|
|
|
T GetFromDictionary<T>(string key, string dataKey);
|
|
|
|
|
|
ICollection<T> GetListFromDictionary<T>(string key);
|
|
|
|
|
|
IEnumerable<T> GetListFromDictionaryByFilter<T>(string key, Func<T, bool> filter);
|
|
|
|
int GetListCountFromDictionaryByFilter<T>(string key, Func<T, bool> filter);
|
|
|
|
bool AddTempContent<T>(string tempId, T data, TimeSpan timeSpan);
|
|
|
|
|
|
T GetTempContent<T>(string tempId);
|
|
|
|
|
|
|
|
}
|
|
}
|