在線文檔:http://doc.yc-l.com/#/README
在線演示地址:http://yc.yc-l.com/#/login
源碼github:https://github.com/linbin524/yc.boilerplate
源碼gitee:https://gitee.com/linxuanming/yc.boilerplate
元磁之力框架技術群QQ:1060819005
視頻教程:
- 元磁之力框架開源初心和框架設計介紹(上): https://www.bilibili.com/video/BV1VM4y1G7hC/
- 元磁之力框架開源初心和框架設計介紹(下): https://www.bilibili.com/video/BV15h411s7w6/
- 元磁之力框架數據庫表和代碼生成使用教程實戰: https://www.bilibili.com/video/BV1oM4y137D5/
緩存功能介紹
緩存模塊統一繼承ICacheManager 接口,目前實現了兩種緩存模式,一種是內存緩存,在YC.Core的層中的MemoryCacheManager實現相關代碼;另一種是Redis緩存,在Module 目錄中獨立一個模塊:YC.Cache.Redis。
MemoryCache
MemoryCache 實現基礎CRUD功能,實現滑動過期,在框架中使用需要在 CustomAutofacModule.cs 注入模塊中進行注入操作。
builder.RegisterType<MemoryCacheManager>().As<ICacheManager>().InstancePerLifetimeScope();
redis Cache
redis 緩存實現基礎CRUD功能,框架中使用Redis Session,解決Session 對Cookie 的依賴。
//redis Session 連接
"ConnectionRedis": {
"Connection": "127.0.0.1:6379,allowAdmin=true,password=123456,defaultdatabase=0",
"InstanceName": "Redis",
"SessionTimeOut": "20"
},
在框架中使用,需要在 CustomAutofacModule.cs 注入模塊中進行如下注入配置操作
var tempConfigOptions = new StackExchange.Redis.ConfigurationOptions();
tempConfigOptions.SyncTimeout = 5000;
tempConfigOptions.ConnectTimeout = 15000;
tempConfigOptions.ResponseTimeout = 15000;
//redis cache注入
builder.RegisterType<RedisCacheManager>().As<ICacheManager>().WithParameter("options", new RedisCacheOptions()
{
Configuration = DefaultConfig.ConnectionRedis.Connection,
InstanceName = DefaultConfig.ConnectionRedis.InstanceName,
ConfigurationOptions = tempConfigOptions,
}).InstancePerLifetimeScope();
