配置文件更改
This commit is contained in:
@@ -105,7 +105,7 @@ builder.Services.AddAuthorizationService();
|
||||
#region
|
||||
//Redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
builder.Services.AddRedisService();
|
||||
builder.Services.AddCacheService();
|
||||
#region
|
||||
//RabbitMQ<4D><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>*<2A><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"StartUrl": "http://*:19001",
|
||||
|
||||
//Ĭ<><C4AC><EFBFBD><EFBFBD>־<EFBFBD><D6BE>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@@ -7,76 +10,111 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"AllowedHosts": "*",
|
||||
|
||||
//Sql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ
|
||||
"SqlLog_Enable": false,
|
||||
|
||||
"Consul_Enabled": false,
|
||||
"DbCodeFirst_Enabled": false,
|
||||
"DbSeed_Enabled": false,
|
||||
"Apollo_Enabled": false,
|
||||
"HealthCheck_Enabled": false,
|
||||
"RabbitMQ_Enabled": false,
|
||||
"Redis_Enabled": false,
|
||||
"RedisSeed_Enabled": false,
|
||||
"Kafka_Enabled": false,
|
||||
"ElasticSeach_Enabled": false,
|
||||
"MutiDB_Enabled": false,
|
||||
"SMS_Enabled": false,
|
||||
"CAP_Enabled": false,
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
"Cors_Enabled": true,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"MutiDB_Enabled": false,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD>CodeFirst<73>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbCodeFirst_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbSeed_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF>б<EFBFBD>
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||
"DbSelect": "Sqlite",
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ<EFBFBD><D6B7>֧<EFBFBD>ֶ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
"DbConn": {
|
||||
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"ReadUrl": [
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
|
||||
]
|
||||
},
|
||||
"JwtAuthorize": {
|
||||
"Issuer": "cc",
|
||||
"Audience": "cc",
|
||||
"PolicyName": "permission",
|
||||
"DefaultScheme": "Bearer",
|
||||
"IsHttps": false,
|
||||
"Expiration": 300,
|
||||
"ReExpiration": 3000
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
"CacheList": [ "Redis", "MemoryCache" ],
|
||||
//ѡ<><EFBFBD>
|
||||
"CacheSelect": "MemoryCache",
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CacheSeed_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Consul<75>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Consul_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"HealthCheck_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><F2BFAAB7>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Cors_Enabled": true,
|
||||
//Apollo<6C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Apollo_Enabled": false,
|
||||
//RabbitMQ<4D>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"RabbitMQ_Enabled": false,
|
||||
//Kafka<6B>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Kafka_Enabled": false,
|
||||
//ElasticSeach<63>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ElasticSeach_Enabled": false,
|
||||
//<2F><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAP_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41><50><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//jwt<77><74>Ȩ<EFBFBD><C8A8><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>Կ˽Կת<D4BF>Ƶ<EFBFBD>Ŀ¼<C4BF>µ<EFBFBD>pem<65>ļ<EFBFBD>
|
||||
"JWTTokenOptions": {
|
||||
"Audience": "http://localhost:19000",
|
||||
"Issuer": "http://localhost:19000",
|
||||
"SecurityKey": "[]"
|
||||
},
|
||||
//Redis<69><73>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RedisConnOptions": {
|
||||
"Host": "[xxxx]",
|
||||
"Host": "[]",
|
||||
"Prot": 6379,
|
||||
"DB": 1,
|
||||
"Password": "[xxxx]"
|
||||
"Password": "[]"
|
||||
},
|
||||
//RabbitMq<4D><71>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RabbitConn": {
|
||||
"HostName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"Password": "[xxxx]",
|
||||
"HostName": "[]",
|
||||
"UserName": "[]",
|
||||
"Password": "[]",
|
||||
"Port": 5672
|
||||
},
|
||||
//ElasticSeach<63><68>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ElasticSeachConn": {
|
||||
"Url": "[xxxx]",
|
||||
"IndexName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"PassWord": "[xxxx]"
|
||||
"Url": "[]",
|
||||
"IndexName": "[]",
|
||||
"UserName": "[]",
|
||||
"PassWord": "[]."
|
||||
},
|
||||
//Kafka<6B><61>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"KafkaOptions": {
|
||||
"BrokerList": "[xxxx]",
|
||||
"TopicName": "[xxxx]"
|
||||
"BrokerList": "[]:9092",
|
||||
"TopicName": "kafkalog"
|
||||
},
|
||||
//Consul<75><6C>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ConsulClientOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "[xxxx]",
|
||||
"Datacenter": "[xxxx]"
|
||||
"IP": "[]",
|
||||
"Port": "8500",
|
||||
"Datacenter": "dc1"
|
||||
},
|
||||
//Consulע<6C>᱾<EFBFBD><E1B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ConsulRegisterOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "19001",
|
||||
"IP": "[]",
|
||||
"Port": "[]",
|
||||
"GroupName": "ApiMicroservice",
|
||||
"HealthCheckUrl": "/Health",
|
||||
"Interval": 10,
|
||||
@@ -84,11 +122,11 @@
|
||||
"DeregisterCriticalServiceAfter": 60,
|
||||
"Tag": "13"
|
||||
},
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS": {
|
||||
"ID": "[xxxx]",
|
||||
"Secret": "[xxxx]",
|
||||
"Sign": "[xxxx]",
|
||||
"Template": "[xxxx]"
|
||||
},
|
||||
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
|
||||
"ID": "[]",
|
||||
"Secret": "[]",
|
||||
"Sign": "[]",
|
||||
"Template": "[]"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>*<2A><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"StartUrl": "http://*:19001",
|
||||
|
||||
//Ĭ<><C4AC><EFBFBD><EFBFBD>־<EFBFBD><D6BE>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@@ -7,76 +10,111 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"AllowedHosts": "*",
|
||||
|
||||
//Sql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ
|
||||
"SqlLog_Enable": false,
|
||||
|
||||
"Consul_Enabled": false,
|
||||
"DbCodeFirst_Enabled": false,
|
||||
"DbSeed_Enabled": false,
|
||||
"Apollo_Enabled": false,
|
||||
"HealthCheck_Enabled": false,
|
||||
"RabbitMQ_Enabled": false,
|
||||
"Redis_Enabled": false,
|
||||
"RedisSeed_Enabled": false,
|
||||
"Kafka_Enabled": false,
|
||||
"ElasticSeach_Enabled": false,
|
||||
"MutiDB_Enabled": false,
|
||||
"SMS_Enabled": false,
|
||||
"CAP_Enabled": false,
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
"Cors_Enabled": true,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"MutiDB_Enabled": false,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD>CodeFirst<73>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbCodeFirst_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbSeed_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF>б<EFBFBD>
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||
"DbSelect": "Sqlite",
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ<EFBFBD><D6B7>֧<EFBFBD>ֶ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
"DbConn": {
|
||||
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"ReadUrl": [
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
|
||||
]
|
||||
},
|
||||
"JwtAuthorize": {
|
||||
"Issuer": "cc",
|
||||
"Audience": "cc",
|
||||
"PolicyName": "permission",
|
||||
"DefaultScheme": "Bearer",
|
||||
"IsHttps": false,
|
||||
"Expiration": 300,
|
||||
"ReExpiration": 3000
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
"CacheList": [ "Redis", "MemoryCache" ],
|
||||
//ѡ<><EFBFBD>
|
||||
"CacheSelect": "MemoryCache",
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CacheSeed_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Consul<75>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Consul_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"HealthCheck_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><F2BFAAB7>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Cors_Enabled": true,
|
||||
//Apollo<6C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Apollo_Enabled": false,
|
||||
//RabbitMQ<4D>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"RabbitMQ_Enabled": false,
|
||||
//Kafka<6B>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Kafka_Enabled": false,
|
||||
//ElasticSeach<63>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ElasticSeach_Enabled": false,
|
||||
//<2F><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAP_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41><50><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//jwt<77><74>Ȩ<EFBFBD><C8A8><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>Կ˽Կת<D4BF>Ƶ<EFBFBD>Ŀ¼<C4BF>µ<EFBFBD>pem<65>ļ<EFBFBD>
|
||||
"JWTTokenOptions": {
|
||||
"Audience": "http://localhost:19000",
|
||||
"Issuer": "http://localhost:19000",
|
||||
"SecurityKey": "[]"
|
||||
},
|
||||
//Redis<69><73>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RedisConnOptions": {
|
||||
"Host": "[xxxx]",
|
||||
"Host": "[]",
|
||||
"Prot": 6379,
|
||||
"DB": 1,
|
||||
"Password": "[xxxx]"
|
||||
"Password": "[]"
|
||||
},
|
||||
//RabbitMq<4D><71>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RabbitConn": {
|
||||
"HostName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"Password": "[xxxx]",
|
||||
"HostName": "[]",
|
||||
"UserName": "[]",
|
||||
"Password": "[]",
|
||||
"Port": 5672
|
||||
},
|
||||
//ElasticSeach<63><68>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ElasticSeachConn": {
|
||||
"Url": "[xxxx]",
|
||||
"IndexName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"PassWord": "[xxxx]"
|
||||
"Url": "[]",
|
||||
"IndexName": "[]",
|
||||
"UserName": "[]",
|
||||
"PassWord": "[]."
|
||||
},
|
||||
//Kafka<6B><61>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"KafkaOptions": {
|
||||
"BrokerList": "[xxxx]",
|
||||
"TopicName": "[xxxx]"
|
||||
"BrokerList": "[]:9092",
|
||||
"TopicName": "kafkalog"
|
||||
},
|
||||
//Consul<75><6C>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ConsulClientOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "[xxxx]",
|
||||
"Datacenter": "[xxxx]"
|
||||
"IP": "[]",
|
||||
"Port": "8500",
|
||||
"Datacenter": "dc1"
|
||||
},
|
||||
//Consulע<6C>᱾<EFBFBD><E1B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ConsulRegisterOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "19001",
|
||||
"IP": "[]",
|
||||
"Port": "[]",
|
||||
"GroupName": "ApiMicroservice",
|
||||
"HealthCheckUrl": "/Health",
|
||||
"Interval": 10,
|
||||
@@ -84,11 +122,11 @@
|
||||
"DeregisterCriticalServiceAfter": 60,
|
||||
"Tag": "13"
|
||||
},
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS": {
|
||||
"ID": "[xxxx]",
|
||||
"Secret": "[xxxx]",
|
||||
"Sign": "[xxxx]",
|
||||
"Template": "[xxxx]"
|
||||
},
|
||||
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
|
||||
"ID": "[]",
|
||||
"Secret": "[]",
|
||||
"Sign": "[]",
|
||||
"Template": "[]"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>*<2A><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"StartUrl": "http://*:19001",
|
||||
|
||||
//Ĭ<><C4AC><EFBFBD><EFBFBD>־<EFBFBD><D6BE>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@@ -7,76 +10,111 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"AllowedHosts": "*",
|
||||
|
||||
//Sql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ
|
||||
"SqlLog_Enable": false,
|
||||
|
||||
"Consul_Enabled": false,
|
||||
"DbCodeFirst_Enabled": true,
|
||||
"DbSeed_Enabled": true,
|
||||
"Apollo_Enabled": false,
|
||||
"HealthCheck_Enabled": false,
|
||||
"RabbitMQ_Enabled": false,
|
||||
"Redis_Enabled": false,
|
||||
"RedisSeed_Enabled": false,
|
||||
"Kafka_Enabled": false,
|
||||
"ElasticSeach_Enabled": false,
|
||||
"MutiDB_Enabled": false,
|
||||
"SMS_Enabled": false,
|
||||
"CAP_Enabled": false,
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
"Cors_Enabled": true,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"MutiDB_Enabled": false,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD>CodeFirst<73>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbCodeFirst_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"DbSeed_Enabled": true,
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF>б<EFBFBD>
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||
"DbSelect": "Sqlite",
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ<EFBFBD><D6B7>֧<EFBFBD>ֶ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
"DbConn": {
|
||||
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"ReadUrl": [
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]",
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]"
|
||||
]
|
||||
},
|
||||
"JwtAuthorize": {
|
||||
"Issuer": "cc",
|
||||
"Audience": "cc",
|
||||
"PolicyName": "permission",
|
||||
"DefaultScheme": "Bearer",
|
||||
"IsHttps": false,
|
||||
"Expiration": 300,
|
||||
"ReExpiration": 3000
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
"CacheList": [ "Redis", "MemoryCache" ],
|
||||
//ѡ<><EFBFBD>
|
||||
"CacheSelect": "MemoryCache",
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CacheSeed_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Consul<75>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Consul_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"HealthCheck_Enabled": false,
|
||||
//<2F><><EFBFBD><EFBFBD><F2BFAAB7>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Cors_Enabled": true,
|
||||
//Apollo<6C>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Apollo_Enabled": false,
|
||||
//RabbitMQ<4D>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"RabbitMQ_Enabled": false,
|
||||
//Kafka<6B>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"Kafka_Enabled": false,
|
||||
//ElasticSeach<63>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ElasticSeach_Enabled": false,
|
||||
//<2F><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAP_Enabled": false,
|
||||
//<2F>ֲ<EFBFBD>ʽCAP<41><50><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
"CAPDashboard_Enabled": false,
|
||||
|
||||
|
||||
//<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>
|
||||
//jwt<77><74>Ȩ<EFBFBD><C8A8><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>Կ˽Կת<D4BF>Ƶ<EFBFBD>Ŀ¼<C4BF>µ<EFBFBD>pem<65>ļ<EFBFBD>
|
||||
"JWTTokenOptions": {
|
||||
"Audience": "http://localhost:19000",
|
||||
"Issuer": "http://localhost:19000",
|
||||
"SecurityKey": "[]"
|
||||
},
|
||||
//Redis<69><73>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RedisConnOptions": {
|
||||
"Host": "[xxxx]",
|
||||
"Host": "[]",
|
||||
"Prot": 6379,
|
||||
"DB": 1,
|
||||
"Password": "[xxxx]"
|
||||
"Password": "[]"
|
||||
},
|
||||
//RabbitMq<4D><71>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"RabbitConn": {
|
||||
"HostName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"Password": "[xxxx]",
|
||||
"HostName": "[]",
|
||||
"UserName": "[]",
|
||||
"Password": "[]",
|
||||
"Port": 5672
|
||||
},
|
||||
//ElasticSeach<63><68>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ElasticSeachConn": {
|
||||
"Url": "[xxxx]",
|
||||
"IndexName": "[xxxx]",
|
||||
"UserName": "[xxxx]",
|
||||
"PassWord": "[xxxx]"
|
||||
"Url": "[]",
|
||||
"IndexName": "[]",
|
||||
"UserName": "[]",
|
||||
"PassWord": "[]."
|
||||
},
|
||||
//Kafka<6B><61>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"KafkaOptions": {
|
||||
"BrokerList": "[xxxx]",
|
||||
"TopicName": "[xxxx]"
|
||||
"BrokerList": "[]:9092",
|
||||
"TopicName": "kafkalog"
|
||||
},
|
||||
//Consul<75><6C>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
||||
"ConsulClientOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "[xxxx]",
|
||||
"Datacenter": "[xxxx]"
|
||||
"IP": "[]",
|
||||
"Port": "8500",
|
||||
"Datacenter": "dc1"
|
||||
},
|
||||
//Consulע<6C>᱾<EFBFBD><E1B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"ConsulRegisterOption": {
|
||||
"IP": "[xxxx]",
|
||||
"Port": "19001",
|
||||
"IP": "[]",
|
||||
"Port": "[]",
|
||||
"GroupName": "ApiMicroservice",
|
||||
"HealthCheckUrl": "/Health",
|
||||
"Interval": 10,
|
||||
@@ -84,11 +122,11 @@
|
||||
"DeregisterCriticalServiceAfter": 60,
|
||||
"Tag": "13"
|
||||
},
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
"SMS": {
|
||||
"ID": "[xxxx]",
|
||||
"Secret": "[xxxx]",
|
||||
"Sign": "[xxxx]",
|
||||
"Template": "[xxxx]"
|
||||
},
|
||||
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
|
||||
"ID": "[]",
|
||||
"Secret": "[]",
|
||||
"Sign": "[]",
|
||||
"Template": "[]"
|
||||
}
|
||||
}
|
||||
@@ -9,34 +9,16 @@ using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using CSRedis;
|
||||
using static CSRedis.CSRedisClient;
|
||||
|
||||
namespace Yi.Framework.Core
|
||||
{
|
||||
public abstract class CacheInvoker
|
||||
{
|
||||
|
||||
private readonly RedisConnOptions _RedisOptions;
|
||||
|
||||
protected CacheInvoker Client { get; set; }
|
||||
|
||||
public CacheInvoker Db { get { return Client; } set { } }
|
||||
public CacheInvoker(IOptionsMonitor<RedisConnOptions> redisConnOptions)
|
||||
public virtual bool Exits(string key)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual bool Exit(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual long Remove(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual long HRemove(string key, params string[] par)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public virtual T Get<T>(string key)
|
||||
{
|
||||
@@ -52,27 +34,120 @@ namespace Yi.Framework.Core
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public virtual T QueuePop<T>(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public virtual long QueuePush<T>(string key, T data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public virtual long QueueLen(string key)
|
||||
|
||||
public virtual long Del(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual bool HSet<T>(string key, string fieId, T data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public virtual bool HSet<T>(string key, string fieId, T data, TimeSpan time)
|
||||
public virtual bool HSet(string key, string fieId, object data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual bool HSet(string key, string fieId, object data, TimeSpan time)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual T HGet<T>(string key, string field)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public virtual long HDel(string key, params string[] par)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual long HLen(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual Dictionary<string, string> HGetAll(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 简单发布
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public virtual long Publish(string channel, string message)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 简单订阅:广播,无持久化,需要Publish写入队列
|
||||
/// </summary>
|
||||
/// <param name="channels"></param>
|
||||
/// <returns></returns>
|
||||
public virtual SubscribeObject Subscribe(params (string, Action<SubscribeMessageEventArgs>)[] channels)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多端争抢模式订阅,需要Lpush写入队列
|
||||
/// </summary>
|
||||
/// <param name="listKey"></param>
|
||||
/// <param name="onMessage"></param>
|
||||
/// <returns></returns>
|
||||
public virtual SubscribeListObject SubscribeList(string listKey, Action<string> onMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多端非争抢模式订阅,需要Lpush写入队列
|
||||
/// </summary>
|
||||
/// <param name="listKey"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="onMessage"></param>
|
||||
/// <returns></returns>
|
||||
public virtual SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action<string> onMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual bool LSet(string key, long index, object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 列表插入头部
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual long LPush<T>(string key, params T[] value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表弹出头部
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public virtual T LPop<T>(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual string[] Keys(string pattern)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,16 @@ using Yi.Framework.Common.IOCOptions;
|
||||
|
||||
namespace Yi.Framework.Core.Cache
|
||||
{
|
||||
public class MemoryCacheClient: CacheInvoker
|
||||
public class MemoryCacheClient : CacheInvoker
|
||||
{
|
||||
private IMemoryCache _client;
|
||||
public MemoryCacheClient(IOptionsMonitor<RedisConnOptions> redisConnOptions):base(redisConnOptions)
|
||||
public MemoryCacheClient()
|
||||
{
|
||||
_client = new MemoryCache(new MemoryCacheOptions() { });
|
||||
_client = new MemoryCache(new MemoryCacheOptions());
|
||||
}
|
||||
public override bool Exits(string key)
|
||||
{
|
||||
return _client.TryGetValue(key, out var _);
|
||||
}
|
||||
public override T Get<T>(string key)
|
||||
{
|
||||
@@ -29,5 +33,11 @@ namespace Yi.Framework.Core.Cache
|
||||
{
|
||||
return _client.Set(key, item, time) is not null;
|
||||
}
|
||||
|
||||
public override long Del(string key)
|
||||
{
|
||||
_client.Remove(key);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
164
Yi.Framework.Net6/Yi.Framework.Core/Cache/RedisCacheClient.cs
Normal file
164
Yi.Framework.Net6/Yi.Framework.Core/Cache/RedisCacheClient.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using CSRedis;
|
||||
using static CSRedis.CSRedisClient;
|
||||
|
||||
namespace Yi.Framework.Core.Cache
|
||||
{
|
||||
public class RedisCacheClient : CacheInvoker
|
||||
{
|
||||
private readonly RedisConnOptions _RedisOptions;
|
||||
|
||||
private CSRedisClient _client;
|
||||
|
||||
public RedisCacheClient(IOptionsMonitor<RedisConnOptions> redisConnOptions)
|
||||
{
|
||||
this._RedisOptions = redisConnOptions.CurrentValue;
|
||||
_client = new CSRedisClient($"{_RedisOptions.Host}:{_RedisOptions.Prot},password={_RedisOptions.Password},defaultDatabase ={ _RedisOptions.DB }");
|
||||
}
|
||||
public override bool Exits(string key)
|
||||
{
|
||||
return _client.Exists(key);
|
||||
}
|
||||
public override T Get<T>(string key)
|
||||
{
|
||||
return _client.Get<T>(key);
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T data, TimeSpan time)
|
||||
{
|
||||
return _client.Set(key, data, time);
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T data)
|
||||
{
|
||||
return _client.Set(key, data);
|
||||
}
|
||||
|
||||
public override long Del(string key)
|
||||
{
|
||||
return _client.Del(key);
|
||||
}
|
||||
|
||||
public override bool HSet(string key, string fieId, object data)
|
||||
{
|
||||
return _client.HSet(key, fieId, data);
|
||||
}
|
||||
|
||||
public override bool HSet(string key, string fieId, object data, TimeSpan time)
|
||||
{
|
||||
var res = _client.HSet(key, fieId, data);
|
||||
var res2 = _client.Expire(key, time);
|
||||
return res && res2;
|
||||
}
|
||||
|
||||
public override T HGet<T>(string key, string field)
|
||||
{
|
||||
return _client.HGet<T>(key, field);
|
||||
}
|
||||
|
||||
|
||||
public override long HDel(string key, params string[] par)
|
||||
{
|
||||
return _client.HDel(key, par);
|
||||
}
|
||||
|
||||
public override long HLen(string key)
|
||||
{
|
||||
return _client.HLen(key);
|
||||
}
|
||||
|
||||
public override Dictionary<string, string> HGetAll(string key)
|
||||
{
|
||||
return _client.HGetAll(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 简单发布
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public override long Publish(string channel, string message)
|
||||
{
|
||||
return _client.Publish(channel, message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 简单订阅:广播,无持久化,需要Publish写入队列
|
||||
/// </summary>
|
||||
/// <param name="channels"></param>
|
||||
/// <returns></returns>
|
||||
public override SubscribeObject Subscribe(params (string, Action<SubscribeMessageEventArgs>)[] channels)
|
||||
{
|
||||
return _client.Subscribe(channels);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多端争抢模式订阅,需要Lpush写入队列
|
||||
/// </summary>
|
||||
/// <param name="listKey"></param>
|
||||
/// <param name="onMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override SubscribeListObject SubscribeList(string listKey, Action<string> onMessage)
|
||||
{
|
||||
return _client.SubscribeList(listKey, onMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多端非争抢模式订阅,需要Lpush写入队列
|
||||
/// </summary>
|
||||
/// <param name="listKey"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="onMessage"></param>
|
||||
/// <returns></returns>
|
||||
public override SubscribeListBroadcastObject SubscribeListBroadcast(string listKey, string clientId, Action<string> onMessage)
|
||||
{
|
||||
return _client.SubscribeListBroadcast(listKey, clientId, onMessage);
|
||||
}
|
||||
|
||||
public override bool LSet(string key, long index, object value)
|
||||
{
|
||||
return _client.LSet(key, index, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 列表插入头部
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override long LPush<T>(string key, params T[] value)
|
||||
{
|
||||
return _client.LPush<T>(key,value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表弹出头部
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public override T LPop<T>(string key)
|
||||
{
|
||||
return _client.LPop<T>(key);
|
||||
}
|
||||
|
||||
public override string[] Keys(string pattern)
|
||||
{
|
||||
return _client.Keys(pattern);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using CSRedis;
|
||||
|
||||
namespace Yi.Framework.Core
|
||||
{
|
||||
public class RedisClient: CacheInvoker
|
||||
{
|
||||
private readonly RedisConnOptions _RedisOptions;
|
||||
|
||||
private CSRedisClient _client;
|
||||
|
||||
public RedisClient(IOptionsMonitor<RedisConnOptions> redisConnOptions):base(redisConnOptions)
|
||||
{
|
||||
this._RedisOptions = redisConnOptions.CurrentValue;
|
||||
_client = new CSRedisClient($"{_RedisOptions.Host}:{_RedisOptions.Prot},password={_RedisOptions.Password},defaultDatabase ={ _RedisOptions.DB }");
|
||||
}
|
||||
|
||||
public override T Get<T>(string key)
|
||||
{
|
||||
return _client.Get<T>(key);
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T data, TimeSpan time)
|
||||
{
|
||||
return _client.Set(key, data, time);
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T data)
|
||||
{
|
||||
return _client.Set(key, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.Core.Cache;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis扩展
|
||||
/// </summary>
|
||||
public static class CacheExtension
|
||||
{
|
||||
public static IServiceCollection AddCacheService(this IServiceCollection services)
|
||||
{
|
||||
var cacheSelect= Appsettings.app("CacheSelect");
|
||||
|
||||
switch (cacheSelect) {
|
||||
case "Redis":
|
||||
services.Configure<RedisConnOptions>(Appsettings.appConfiguration("RedisConnOptions"));
|
||||
services.AddSingleton<CacheInvoker, RedisCacheClient>();
|
||||
break;
|
||||
case "MemoryCache":
|
||||
services.AddSingleton<CacheInvoker, MemoryCacheClient>();
|
||||
break;
|
||||
default:throw new ArgumentException("CacheSelect配置填的是什么东西?俺不认得");
|
||||
}
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,13 @@ using Yi.Framework.Core;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
public static class RedisInitExtend
|
||||
public static class CacheInitExtend
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RedisInitExtend));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CacheInitExtend));
|
||||
public static void UseRedisSeedInitService(this IApplicationBuilder app )
|
||||
{
|
||||
|
||||
if (Appsettings.appBool("RedisSeed_Enabled"))
|
||||
if (Appsettings.appBool("CacheSeed_Enabled"))
|
||||
{
|
||||
var _cacheClientDB = app.ApplicationServices.GetService<CacheInvoker>();
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Yi.Framework.Common.IOCOptions;
|
||||
using Yi.Framework.Core;
|
||||
|
||||
namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis扩展
|
||||
/// </summary>
|
||||
public static class RedisExtension
|
||||
{
|
||||
public static IServiceCollection AddRedisService(this IServiceCollection services)
|
||||
{
|
||||
if (Appsettings.appBool("Redis_Enabled"))
|
||||
{
|
||||
services.Configure<RedisConnOptions>(Appsettings.appConfiguration("RedisConnOptions"));
|
||||
services.AddSingleton<CacheInvoker>();
|
||||
}
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user