40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace WX.CRM.Model.Redis
|
|
{
|
|
public enum RedisConfig
|
|
{
|
|
Redis0 = 0,
|
|
Redis1 = 1
|
|
}
|
|
|
|
public class KeysDic
|
|
{
|
|
/// <summary>
|
|
/// Dictionary<类型名, Redis的Key路径>,统一用小写字母
|
|
/// </summary>
|
|
protected static Dictionary<string, string> dic = new Dictionary<string, string>()
|
|
{
|
|
{"res_customerdetail","res_customerdetail"}
|
|
,{"res_customer","res_customer"}
|
|
,{"gjs_customer","gjs_customer"}
|
|
,{"gjs_customerboce","gjs_customerboce"}
|
|
,{"soft_user","soft_user"}
|
|
,{"res_customeruser_resid","res_customeruser_resid"}
|
|
,{"res_customeruser_username","res_customeruser_username"}
|
|
,{"cache_ord_memo","cache_ord_memo"}
|
|
,{"ord_memocontent","ord_memocontent"}
|
|
,{"resid_memoid_redis","resid_memoid_redis"}
|
|
,{"res_calloutcustomer","res_calloutcustomer"}
|
|
};
|
|
|
|
public static string GetKey<T>(string id) where T : new()
|
|
{
|
|
id = string.Format("{0}", id).ToLower();
|
|
T o = new T();
|
|
string s = o.GetType().Name.ToLower();
|
|
return string.Format("{0}:{1}", dic[s], id);
|
|
}
|
|
}
|
|
}
|