Skip to content

Commit dad6cfe

Browse files
committed
[refactor] remove unused project
1 parent 23976fb commit dad6cfe

18 files changed

+34
-161
lines changed

RedisPubSub.Common/RedisPubSub.Common.csproj

-9
This file was deleted.

RedisPubSub.Publisher/Program.cs

-26
This file was deleted.

RedisPubSub.Subscriber/Properties/launchSettings.json

-28
This file was deleted.

RedisPubSub.Subscriber/RedisPubSub.Subscriber.csproj

-11
This file was deleted.

RedisPubSub.Subscriber/RedisPubSub.Subscriber.csproj.user

-9
This file was deleted.

RedisPubSub.Subscriber/Startup.cs

-29
This file was deleted.

RedisPubSub.sln

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30717.126
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RedisPubSub.Publisher", "RedisPubSub.Publisher\RedisPubSub.Publisher.csproj", "{E57A9EF8-879B-4746-9E13-6E787A46F956}"
7-
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisPubSub.Common", "RedisPubSub.Common\RedisPubSub.Common.csproj", "{250CBFDA-5B47-4E35-A742-BA3E6A2A2C3A}"
9-
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisPubSub.Subscriber", "RedisPubSub.Subscriber\RedisPubSub.Subscriber.csproj", "{11642D18-4B01-41AE-9D04-A411762EB12B}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RedisPubSub", "RedisPubSub\RedisPubSub.csproj", "{E57A9EF8-879B-4746-9E13-6E787A46F956}"
117
EndProject
128
Global
139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,14 +15,6 @@ Global
1915
{E57A9EF8-879B-4746-9E13-6E787A46F956}.Debug|Any CPU.Build.0 = Debug|Any CPU
2016
{E57A9EF8-879B-4746-9E13-6E787A46F956}.Release|Any CPU.ActiveCfg = Release|Any CPU
2117
{E57A9EF8-879B-4746-9E13-6E787A46F956}.Release|Any CPU.Build.0 = Release|Any CPU
22-
{250CBFDA-5B47-4E35-A742-BA3E6A2A2C3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{250CBFDA-5B47-4E35-A742-BA3E6A2A2C3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{250CBFDA-5B47-4E35-A742-BA3E6A2A2C3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{250CBFDA-5B47-4E35-A742-BA3E6A2A2C3A}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{11642D18-4B01-41AE-9D04-A411762EB12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{11642D18-4B01-41AE-9D04-A411762EB12B}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{11642D18-4B01-41AE-9D04-A411762EB12B}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{11642D18-4B01-41AE-9D04-A411762EB12B}.Release|Any CPU.Build.0 = Release|Any CPU
3018
EndGlobalSection
3119
GlobalSection(SolutionProperties) = preSolution
3220
HideSolutionNode = FALSE

RedisPubSub.Common/Constants/RedisChannelConstant.cs renamed to RedisPubSub/Constants/RedisChannelConstant.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Text;
3+
using System.Linq;
4+
using System.Threading.Tasks;
45

5-
namespace RedisPubSub.Common.Constants
6+
namespace RedisPubSub.Constants
67
{
78
public static class RedisChannelConstant
89
{

RedisPubSub.Publisher/Controllers/PublisherController.cs renamed to RedisPubSub/Controllers/PublisherController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Microsoft.AspNetCore.Http;
22
using Microsoft.AspNetCore.Mvc;
3-
using RedisPubSub.Publisher.Services;
3+
using RedisPubSub.Services;
44
using System;
55
using System.Collections.Generic;
66
using System.Linq;
77
using System.Threading.Tasks;
88

9-
namespace RedisPubSub.Publisher.Controllers
9+
namespace RedisPubSub.Controllers
1010
{
1111
[Route("api/[controller]")]
1212
[ApiController]

RedisPubSub.Common/Extensions/StartupExtension.cs renamed to RedisPubSub/Extensions/StartupExtension.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using Microsoft.Extensions.Configuration;
22
using Microsoft.Extensions.DependencyInjection;
33
using StackExchange.Redis;
4-
5-
namespace RedisPubSub.Common.Extensions
4+
namespace RedisPubSub.Extensions
65
{
7-
public static class StartupExtension
6+
public static class StartupExtension
87
{
98
public static void RegisterMultiplexer(this IServiceCollection services, IConfiguration configuration)
109
{

RedisPubSub.Subscriber/HostedServices/RedisSubscriberHostedService.cs renamed to RedisPubSub/HostedServices/RedisSubscriberHostedService.cs

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using Microsoft.Extensions.Caching.Memory;
22
using Microsoft.Extensions.Hosting;
33
using Microsoft.Extensions.Logging;
4-
using RedisPubSub.Common.Constants;
5-
using RedisPubSub.Common.Models;
4+
using RedisPubSub.Constants;
5+
using RedisPubSub.Models;
66
using StackExchange.Redis;
7-
using System;
87
using System.Threading;
98
using System.Threading.Tasks;
109

11-
namespace RedisPubSub.Subscriber.HostedServices
10+
namespace RedisPubSub.HostedServices
1211
{
1312
public class RedisSubscriberHostedService : BackgroundService
1413
{
@@ -25,12 +24,12 @@ public RedisSubscriberHostedService(IConnectionMultiplexer connectionMultiplexer
2524
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
2625
{
2726
await _subscriber.SubscribeAsync(RedisChannelConstant.MemoryCache, (a, updatedData) =>
28-
{
29-
var data = System.Text.Json.JsonSerializer.Deserialize<MemoryCacheDataDto>(updatedData);
30-
_memoryCache.Remove(data.CacheKey);
31-
_memoryCache.Set(data.CacheKey, data.Data);
32-
_logger.LogInformation($"MemoryCache update. Key:{data.CacheKey}");
33-
});
27+
{
28+
var data = System.Text.Json.JsonSerializer.Deserialize<MemoryCacheDataDto>(updatedData);
29+
_memoryCache.Remove(data.CacheKey);
30+
_memoryCache.Set(data.CacheKey, data.Data);
31+
_logger.LogInformation($"MemoryCache update. Key:{data.CacheKey}");
32+
});
3433
}
3534
public override async Task StopAsync(CancellationToken cancellationToken)
3635
{

RedisPubSub.Common/Models/MemoryCacheDataDto.cs renamed to RedisPubSub/Models/MemoryCacheDataDto.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Text;
3+
using System.Linq;
4+
using System.Threading.Tasks;
45

5-
namespace RedisPubSub.Common.Models
6+
namespace RedisPubSub.Models
67
{
78
public class MemoryCacheDataDto
89
{

RedisPubSub.Subscriber/Program.cs renamed to RedisPubSub/Program.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Linq;
88
using System.Threading.Tasks;
99

10-
namespace RedisPubSub.Subscriber
10+
namespace RedisPubSub
1111
{
1212
public class Program
1313
{
@@ -21,6 +21,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
2121
.ConfigureWebHostDefaults(webBuilder =>
2222
{
2323
webBuilder.UseStartup<Startup>();
24+
webBuilder.UseUrls(args);
2425
});
2526
}
2627
}

RedisPubSub.Publisher/Properties/launchSettings.json renamed to RedisPubSub/Properties/launchSettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"ASPNETCORE_ENVIRONMENT": "Development"
1616
}
1717
},
18-
"RedisPubSub.Publisher": {
18+
"RedisPubSub": {
1919
"commandName": "Project",
2020
"launchBrowser": true,
2121
"environmentVariables": {

RedisPubSub.Publisher/RedisPubSub.Publisher.csproj renamed to RedisPubSub/RedisPubSub.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
<PropertyGroup>
44
<TargetFramework>net5.0</TargetFramework>
55
</PropertyGroup>
6-
76
<ItemGroup>
8-
<ProjectReference Include="..\RedisPubSub.Common\RedisPubSub.Common.csproj" />
7+
<PackageReference Include="EasyCaching.Redis" Version="1.4.1" />
98
</ItemGroup>
109

1110
</Project>

RedisPubSub.Publisher/RedisPubSub.Publisher.csproj.user renamed to RedisPubSub/RedisPubSub.csproj.user

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
55
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
6-
<ActiveDebugProfile>RedisPubSub.Publisher</ActiveDebugProfile>
6+
<ActiveDebugProfile>RedisPubSub</ActiveDebugProfile>
77
</PropertyGroup>
88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
99
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>

RedisPubSub.Publisher/Services/RedisPublisher.cs renamed to RedisPubSub/Services/RedisPublisher.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using RedisPubSub.Common.Constants;
2-
using RedisPubSub.Common.Models;
1+
using RedisPubSub.Constants;
2+
using RedisPubSub.Models;
33
using StackExchange.Redis;
44
using System.Threading.Tasks;
55

6-
namespace RedisPubSub.Publisher.Services
6+
namespace RedisPubSub.Services
77
{
88
public interface IRedisPublisher
99
{

RedisPubSub.Publisher/Startup.cs renamed to RedisPubSub/Startup.cs

+6-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
using Microsoft.AspNetCore.Http;
44
using Microsoft.Extensions.Configuration;
55
using Microsoft.Extensions.DependencyInjection;
6-
using Microsoft.Extensions.Hosting;
7-
using RedisPubSub.Common.Extensions;
8-
using RedisPubSub.Publisher.Services;
9-
using StackExchange.Redis;
10-
using System;
11-
using System.Collections.Generic;
12-
using System.Linq;
13-
using System.Threading.Tasks;
6+
using RedisPubSub.Extensions;
7+
using RedisPubSub.HostedServices;
8+
using RedisPubSub.Services;
149

15-
namespace RedisPubSub.Publisher
10+
namespace RedisPubSub
1611
{
1712
public class Startup
1813
{
@@ -27,6 +22,8 @@ public void ConfigureServices(IServiceCollection services)
2722
services.RegisterMultiplexer(Configuration);
2823
services.AddSingleton<IRedisPublisher, RedisPublisher>();
2924
services.AddControllers();
25+
services.AddMemoryCache();
26+
services.AddHostedService<RedisSubscriberHostedService>();
3027
}
3128

3229
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

0 commit comments

Comments
 (0)