Skip to content

Commit

Permalink
Merge pull request #411 from dotnetcore/dev
Browse files Browse the repository at this point in the history
release v1.7.0
  • Loading branch information
catcherwong authored Oct 25, 2022
2 parents 769ef24 + 69c032d commit 174a00a
Show file tree
Hide file tree
Showing 61 changed files with 2,456 additions and 550 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ jobs:
run: |
for file in nugetpkgs/*.nupkg
do
dotnet nuget push $file -k ${{ secrets.MYGET_API_KEY }} --skip-duplicate -s https://www.myget.org/F/ncc/api/v2/package
dotnet nuget push $file -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate -s https://www.nuget.org/api/v2/package
done
18 changes: 16 additions & 2 deletions EasyCaching.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29324.140
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A0F5CC7E-155F-4726-8DEB-E966950B3FE9}"
EndProject
Expand Down Expand Up @@ -70,6 +70,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.LiteDB", "src\E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Serialization.SystemTextJson", "serialization\EasyCaching.Serialization.SystemTextJson\EasyCaching.Serialization.SystemTextJson.csproj", "{4FCF16BF-5E21-4B74-AB45-3C121ADF1485}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyCaching.Bus.ConfluentKafka", "bus\EasyCaching.Bus.ConfluentKafka\EasyCaching.Bus.ConfluentKafka.csproj", "{F7FBADEB-D766-4595-949A-07104B52692C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Bus.Zookeeper", "bus\EasyCaching.Bus.Zookeeper\EasyCaching.Bus.Zookeeper.csproj", "{5E488583-391E-4E15-83C1-7301B4FE79AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -184,6 +188,14 @@ Global
{4FCF16BF-5E21-4B74-AB45-3C121ADF1485}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FCF16BF-5E21-4B74-AB45-3C121ADF1485}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FCF16BF-5E21-4B74-AB45-3C121ADF1485}.Release|Any CPU.Build.0 = Release|Any CPU
{F7FBADEB-D766-4595-949A-07104B52692C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7FBADEB-D766-4595-949A-07104B52692C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7FBADEB-D766-4595-949A-07104B52692C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7FBADEB-D766-4595-949A-07104B52692C}.Release|Any CPU.Build.0 = Release|Any CPU
{5E488583-391E-4E15-83C1-7301B4FE79AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E488583-391E-4E15-83C1-7301B4FE79AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E488583-391E-4E15-83C1-7301B4FE79AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E488583-391E-4E15-83C1-7301B4FE79AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -216,6 +228,8 @@ Global
{711603E1-8363-4F8D-9AA9-8C03EC8BD35F} = {B4241D34-A973-4A13-BD89-9BAE3F2BDDF6}
{BA850294-3103-4540-8A27-FC768E1DC8FC} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
{4FCF16BF-5E21-4B74-AB45-3C121ADF1485} = {15070C49-A507-4844-BCFE-D319CFBC9A63}
{F7FBADEB-D766-4595-949A-07104B52692C} = {B337509B-75F9-4851-821F-9BBE87C4E4BC}
{5E488583-391E-4E15-83C1-7301B4FE79AE} = {B337509B-75F9-4851-821F-9BBE87C4E4BC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63A57886-054B-476C-AAE1-8D7C8917682E}
Expand Down
35 changes: 24 additions & 11 deletions build/releasenotes.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageNotes>
1. Add CancellationToken for async methods.
1. Remove BinaryFormatter.
2. Support removing cache keys by pattern.
</EasyCachingCorePackageNotes>
<EasyCachingMemcachedPackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
</EasyCachingMemcachedPackageNotes>
<EasyCachingRedisPackageNotes>
1. Add CancellationToken for async methods.
2. Add persist key method to redis providers.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingRedisPackageNotes>
<EasyCachingSQLitePackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingSQLitePackageNotes>
<EasyCachingInMemoryPackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingInMemoryPackageNotes>
<EasyCachingHybridPackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingHybridPackageNotes>
<EasyCachingAspectCorePackageNotes>
1. Upgrading dependencies.
Expand All @@ -38,23 +42,32 @@
1. Upgrading dependencies.
</EasyCachingProtobufPackageNotes>
<EasyCachingCSRedisPackageNotes>
1. Add CancellationToken for async methods.
2. Add persist key method to redis providers.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingCSRedisPackageNotes>
<EasyCachingCSRedisBusPackageNotes>
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingCSRedisBusPackageNotes>
<EasyCachingRedisBusPackageNotes>
1. Upgrading dependencies.
</EasyCachingRedisBusPackageNotes>
<EasyCachingRabbitBusPackageNotes>
1. Upgrading dependencies.
</EasyCachingRabbitBusPackageNotes>
<EasyCachingKafkaBusPackageNotes>
1. Add EasyCachingKafkaBus.
</EasyCachingKafkaBusPackageNotes>
<EasyCachingZookeeperBusPackageNotes>
1. Add EasyCachingZookeeperBus.
</EasyCachingZookeeperBusPackageNotes>
<EasyCachingDiskPackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingDiskPackageNotes>
<EasyCachingLiteDBPackageNotes>
1. Add CancellationToken for async methods.
1. Upgrading dependencies.
2. Support removing cache keys by pattern.
</EasyCachingLiteDBPackageNotes>
<EasyCachingSTJsonPackageNotes>
1. Upgrading dependencies.
Expand Down
42 changes: 22 additions & 20 deletions build/version.props
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageVersion>1.6.1</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>1.6.1</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>1.6.1</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>1.6.1</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>1.6.1</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>1.6.1</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>1.6.1</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>1.6.1</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>1.6.1</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>1.6.1</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>1.6.1</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>1.6.1</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>1.6.1</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>1.6.1</EasyCachingRedisBusPackageVersion>
<EasyCachingCSRedisBusPackageVersion>1.6.1</EasyCachingCSRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>1.6.1</EasyCachingRabbitBusPackageVersion>
<EasyCachingDiskPackageVersion>1.6.1</EasyCachingDiskPackageVersion>
<EasyCachingMsExtPackageVersion>1.6.1</EasyCachingMsExtPackageVersion>
<EasyCachingLiteDBPackageVersion>1.6.1</EasyCachingLiteDBPackageVersion>
<EasyCachingSTJsonPackageVersion>1.6.1</EasyCachingSTJsonPackageVersion>
<EasyCachingCorePackageVersion>1.7.0</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>1.7.0</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>1.7.0</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>1.7.0</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>1.7.0</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>1.7.0</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>1.7.0</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>1.7.0</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>1.7.0</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>1.7.0</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>1.7.0</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>1.7.0</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>1.7.0</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>1.7.0</EasyCachingRedisBusPackageVersion>
<EasyCachingCSRedisBusPackageVersion>1.7.0</EasyCachingCSRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>1.7.0</EasyCachingRabbitBusPackageVersion>
<EasyCachingKafkaBusPackageVersion>1.7.0</EasyCachingKafkaBusPackageVersion>
<EasyCachingZookeeperBusPackageVersion>1.7.0</EasyCachingZookeeperBusPackageVersion>
<EasyCachingDiskPackageVersion>1.7.0</EasyCachingDiskPackageVersion>
<EasyCachingMsExtPackageVersion>1.7.0</EasyCachingMsExtPackageVersion>
<EasyCachingLiteDBPackageVersion>1.7.0</EasyCachingLiteDBPackageVersion>
<EasyCachingSTJsonPackageVersion>1.7.0</EasyCachingSTJsonPackageVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public void AddServices(IServiceCollection services)
{
services.AddOptions();

services.TryAddSingleton<IEasyCachingSerializer, DefaultBinaryFormatterSerializer>();

services.Configure(_name, _configure);

services.AddSingleton<EasyCachingCSRedisClient>(x =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Confluent.Kafka;

namespace EasyCaching.Bus.ConfluentKafka
{
/// <summary>
/// kafka bus options
/// </summary>
public class ConfluentKafkaBusOptions
{
/// <summary>
/// kafka address(BootstrapServers must)
/// </summary>
public string BootstrapServers { get; set; }


/// <summary>
/// kafka bus producer options.
/// </summary>
public ProducerConfig ProducerConfig { get; set; }

/// <summary>
/// kafka bus consumer options.(if GroupId value below is empty,then ConsumerConfig.GroupId must )
/// </summary>
public ConsumerConfig ConsumerConfig { get; set; }

/// <summary>
/// kafka bus consumer options with consumer groupId
/// (if ConsumerConfig below has give GroupId value , this options can ignore)
/// import:if application is cluster,you should set this different value in application,this will make consumer can consumerdata
/// </summary>
public string GroupId { get; set; }

/// <summary>
/// kafka bus consumer consume count
/// </summary>
public int ConsumerCount { get; set; } = 1;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace EasyCaching.Bus.ConfluentKafka
{
using System;
using EasyCaching.Core.Bus;
using EasyCaching.Core.Configurations;
using EasyCaching.Core.Serialization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

/// <summary>
/// Kafka options extension.
/// </summary>
internal sealed class ConfluentKafkaOptionsExtension : IEasyCachingOptionsExtension
{

private readonly Action<ConfluentKafkaBusOptions> _confluentKafkaBusOptions;

public ConfluentKafkaOptionsExtension(Action<ConfluentKafkaBusOptions> confluentKafkaBusOptions)
{
this._confluentKafkaBusOptions = confluentKafkaBusOptions;
}

/// <summary>
/// Adds the services.
/// </summary>
/// <param name="services">Services.</param>
public void AddServices(IServiceCollection services)
{
services.AddOptions();

services.AddOptions<ConfluentKafkaBusOptions>()
.Configure(_confluentKafkaBusOptions);


//var options = services.BuildServiceProvider()
// .GetRequiredService<IOptions<ConfluentKafkaBusOptions>>()
// .Value;

services.AddSingleton<IEasyCachingBus, DefaultConfluentKafkaBus>();

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
namespace Microsoft.Extensions.DependencyInjection
{
using Confluent.Kafka;
using EasyCaching.Bus.ConfluentKafka;
using EasyCaching.Core;
using EasyCaching.Core.Configurations;
using Microsoft.Extensions.Configuration;
using System;

/// <summary>
/// EasyCaching options extensions.
/// </summary>
public static class EasyCachingOptionsExtensions
{
/// <summary>
/// Withs the ConfluentKafka bus (specify the config via hard code).
/// </summary>
/// <param name="options"></param>
/// <param name="configure"></param>
/// <returns></returns>
public static EasyCachingOptions WithConfluentKafkaBus(
this EasyCachingOptions options
, Action<ConfluentKafkaBusOptions> configure
)
{
ArgumentCheck.NotNull(configure, nameof(configure));
//option convert
ConfluentKafkaBusOptions kafkaOptions = new ConfluentKafkaBusOptions();
configure.Invoke(kafkaOptions);
void kafkaBusConfigure(ConfluentKafkaBusOptions x)
{
x.BootstrapServers = kafkaOptions.BootstrapServers;
x.ProducerConfig = kafkaOptions.ProducerConfig ?? new ProducerConfig();
x.ConsumerConfig = kafkaOptions.ConsumerConfig ?? new ConsumerConfig();
//address
x.ProducerConfig.BootstrapServers = x.ProducerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers;
x.ConsumerConfig.BootstrapServers = x.ConsumerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers;
//consumer groupId
x.ConsumerConfig.GroupId = x.ConsumerConfig.GroupId ?? kafkaOptions.GroupId;
x.ConsumerConfig.AutoOffsetReset = kafkaOptions.ConsumerConfig.AutoOffsetReset ?? AutoOffsetReset.Latest;
}

options.RegisterExtension(new ConfluentKafkaOptionsExtension(kafkaBusConfigure));
return options;
}

/// <summary>
/// Withs the ConfluentKafka bus (read config from configuration file).
/// </summary>
/// <param name="options"></param>
/// <param name="configuration"></param>
/// <param name="sectionName">The section name in the configuration file.</param>
/// <returns></returns>
public static EasyCachingOptions WithConfluentKafkaBus(
this EasyCachingOptions options
, IConfiguration configuration
, string sectionName = EasyCachingConstValue.KafkaBusSection
)
{
var dbConfig = configuration.GetSection(sectionName);
var kafkaOptions = new ConfluentKafkaBusOptions();
dbConfig.Bind(kafkaOptions);

void configure(ConfluentKafkaBusOptions x)
{
x.BootstrapServers = kafkaOptions.BootstrapServers;
x.ProducerConfig = kafkaOptions.ProducerConfig ?? new ProducerConfig();
x.ConsumerConfig = kafkaOptions.ConsumerConfig ?? new ConsumerConfig();
//address
x.ProducerConfig.BootstrapServers = x.ProducerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers;
x.ConsumerConfig.BootstrapServers = x.ConsumerConfig.BootstrapServers ?? kafkaOptions.BootstrapServers;
//consumer groupId
x.ConsumerConfig.GroupId = x.ConsumerConfig.GroupId ?? kafkaOptions.GroupId;
x.ConsumerConfig.AutoOffsetReset = kafkaOptions.ConsumerConfig.AutoOffsetReset ?? AutoOffsetReset.Latest;
}

options.RegisterExtension(new ConfluentKafkaOptionsExtension(configure));
return options;
}
}
}
Loading

0 comments on commit 174a00a

Please sign in to comment.