Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions build/releasenotes.props
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageNotes>
1. Add IRedisCachingProvider.
1. EasyCaching Bus
2. HybridCaching
</EasyCachingCorePackageNotes>
<EasyCachingMemcachedPackageNotes>
1. Improve Get cached value.
1. Adjust reference namespace.
</EasyCachingMemcachedPackageNotes>
<EasyCachingRedisPackageNotes>
1. Add Impl of IRedisCachingProvider.
1. Adjust reference namespace.
</EasyCachingRedisPackageNotes>
<EasyCachingSQLitePackageNotes>
1. Improve Configuration.
1. Adjust reference namespace.
</EasyCachingSQLitePackageNotes>
<EasyCachingInMemoryPackageNotes>
1. Update Options.
2. Improve Get cached value.
1. Adjust reference namespace.
</EasyCachingInMemoryPackageNotes>
<EasyCachingHybridPackageNotes>
1. Improve Configuration.
1. Refactor.
</EasyCachingHybridPackageNotes>
<EasyCachingAspectCorePackageNotes>
1. Fixed bug of IConvertible.
1. Adjust reference namespace.
</EasyCachingAspectCorePackageNotes>
<EasyCachingCastlePackageNotes>
1. Remove Dependency of IEasyCaching.
1. Adjust reference namespace.
</EasyCachingCastlePackageNotes>
<EasyCachingResponseCachingPackageNotes>
1. Support .NET Core 2.1
1. Adjust reference namespace.
</EasyCachingResponseCachingPackageNotes>
<EasyCachingJsonPackageNotes>
1. Improve Configuration.
1. Adjust reference namespace.
</EasyCachingJsonPackageNotes>
<EasyCachingMessagePackPackageNotes>
1. Improve Configuration.
1. Adjust reference namespace.
</EasyCachingMessagePackPackageNotes>
<EasyCachingProtobufPackageNotes>
1. Improve Configuration.
1. Adjust reference namespace.
</EasyCachingProtobufPackageNotes>
<EasyCachingCSRedisPackageNotes>
1. Init.
1. Adjust reference namespace.
</EasyCachingCSRedisPackageNotes>
<EasyCachingRedisBusPackageNotes>
1. Init.
</EasyCachingRedisBusPackageNotes>
<EasyCachingRabbitBusPackageNotes>
1. Init.
</EasyCachingRabbitBusPackageNotes>
</PropertyGroup>
</Project>
28 changes: 15 additions & 13 deletions build/version.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageVersion>0.4.6</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>0.4.5.1</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>0.4.6</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>0.4.5</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>0.4.6</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>0.4.5</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>0.3.3</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>0.3.2</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>0.3.0</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>0.3.5</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>0.3.5</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>0.3.5</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>0.1.0</EasyCachingCSRedisPackageVersion>
<EasyCachingCorePackageVersion>0.5.0</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>0.5.0</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>0.5.0</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>0.5.0</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>0.5.0</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>0.5.0</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>0.5.0</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>0.5.0</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>0.5.0</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>0.5.0</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>0.5.0</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>0.5.0</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>0.5.0</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>0.5.0</EasyCachingRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>0.5.0-alpha</EasyCachingRabbitBusPackageVersion>
</PropertyGroup>
</Project>
Binary file added media/hybrid_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace EasyCaching.Demo.Interceptors.Services
{
using EasyCaching.Core.Internal;
using System.Threading.Tasks;

using EasyCaching.Core.Interceptor;

public interface IAspectCoreService //: EasyCaching.Core.Internal.IEasyCaching
{
[EasyCachingAble(Expiration = 10)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace EasyCaching.Demo.Interceptors.Services
{
using System.Threading.Tasks;
using EasyCaching.Core.Interceptor;
using EasyCaching.Core.Internal;

public interface ICastleService
Expand Down
1 change: 1 addition & 0 deletions sample/EasyCaching.Demo.Providers/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using EasyCaching.Core.Configurations;

public class Startup
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace EasyCaching.Bus.RabbitMQ
{
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options;
using global::RabbitMQ.Client;

/// <summary>
/// Connection pooled object policy.
/// </summary>
public class ConnectionPooledObjectPolicy : IPooledObjectPolicy<IConnection>
{
/// <summary>
/// The options.
/// </summary>
private readonly RabbitMQBusOptions _options;

/// <summary>
/// Initializes a new instance of the <see cref="T:EasyCaching.Bus.RabbitMQ.ConnectionPooledObjectPolicy"/> class.
/// </summary>
/// <param name="optionsAccs">Options accs.</param>
public ConnectionPooledObjectPolicy(IOptions<RabbitMQBusOptions> optionsAccs)
{
this._options = optionsAccs.Value;
}

/// <summary>
/// Create this instance.
/// </summary>
/// <returns>The create.</returns>
public IConnection Create()
{
var factory = new ConnectionFactory
{
HostName = _options.HostName,
UserName = _options.UserName,
Port = _options.Port,
Password = _options.Password,
VirtualHost = _options.VirtualHost,
RequestedConnectionTimeout = _options.RequestedConnectionTimeout,
SocketReadTimeout = _options.SocketReadTimeout,
SocketWriteTimeout = _options.SocketWriteTimeout
};

var connection = factory.CreateConnection();
return connection;
}

/// <summary>
/// Return the specified connection.
/// </summary>
/// <returns>The return.</returns>
/// <param name="connection">Connection.</param>
public bool Return(IConnection connection)
{
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
namespace EasyCaching.Bus.RabbitMQ
{
using System;
using EasyCaching.Core.Configurations;
using Microsoft.Extensions.Configuration;

/// <summary>
/// EasyCaching options extensions.
/// </summary>
public static class EasyCachingOptionsExtensions
{
/// <summary>
/// Withs the RabbitMQ Bus.
/// </summary>
/// <returns>The rabbit MQB us.</returns>
/// <param name="options">Options.</param>
/// <param name="configure">Configure.</param>
public static EasyCachingOptions WithRabbitMQBus(this EasyCachingOptions options, Action<RabbitMQBusOptions> configure)
{
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}

options.RegisterExtension(new RabbitMQBusOptionsExtension(configure));
return options;
}

/// <summary>
/// Withs the RabbitMQ Bus.
/// </summary>
/// <returns>The rabbit MQB us.</returns>
/// <param name="options">Options.</param>
/// <param name="configuration">Configuration.</param>
/// <param name="sectionName">Section name.</param>
public static EasyCachingOptions WithRabbitMQBus(this EasyCachingOptions options, IConfiguration configuration, string sectionName = "rabbitmqbus")
{
var dbConfig = configuration.GetSection(sectionName);
var busOptions = new RabbitMQBusOptions();
dbConfig.Bind(busOptions);

void configure(RabbitMQBusOptions x)
{
x.HostName = busOptions.HostName;
x.Password = busOptions.Password;
x.Port = busOptions.Port;
x.QueueMessageExpires = busOptions.QueueMessageExpires;
x.RequestedConnectionTimeout = busOptions.RequestedConnectionTimeout;
x.RouteKey = busOptions.RouteKey;
x.SocketReadTimeout = busOptions.SocketReadTimeout;
x.SocketWriteTimeout = busOptions.SocketWriteTimeout;
x.TopicExchangeName = busOptions.TopicExchangeName;
x.UserName = busOptions.UserName;
x.VirtualHost = busOptions.VirtualHost;
x.QueueName = busOptions.QueueName;
}

options.RegisterExtension(new RabbitMQBusOptionsExtension(configure));
return options;
}
}
}
22 changes: 22 additions & 0 deletions src/EasyCaching.Bus.RabbitMQ/Configurations/RabbitMQBusOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace EasyCaching.Bus.RabbitMQ
{
using EasyCaching.Core.Configurations;

/// <summary>
/// RabbitMQ Bus options.
/// </summary>
public class RabbitMQBusOptions : BaseRabbitMQOptions
{
/// <summary>
/// Gets or sets the route key.
/// </summary>
/// <value>The route key.</value>
public string RouteKey { get; set; } = "rmq.queue.undurable.easycaching.subscriber.*";

/// <summary>
/// Gets or sets the name of the queue.
/// </summary>
/// <value>The name of the queue.</value>
public string QueueName { get; set; } = "";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
namespace EasyCaching.Bus.RabbitMQ
{
using System;
using EasyCaching.Core.Bus;
using EasyCaching.Core.Configurations;
using EasyCaching.Core.Serialization;
using global::RabbitMQ.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.ObjectPool;

/// <summary>
/// RabbitMQ Bus options extension.
/// </summary>
public class RabbitMQBusOptionsExtension : IEasyCachingOptionsExtension
{
/// <summary>
/// The configure.
/// </summary>
private readonly Action<RabbitMQBusOptions> configure;

/// <summary>
/// Initializes a new instance of the <see cref="T:EasyCaching.Bus.RabbitMQ.RabbitMQBusOptionsExtension"/> class.
/// </summary>
/// <param name="configure">Configure.</param>
public RabbitMQBusOptionsExtension(Action<RabbitMQBusOptions> configure)
{
this.configure = configure;
}

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

services.TryAddSingleton<IEasyCachingSerializer, DefaultBinaryFormatterSerializer>();
services.AddSingleton<IPooledObjectPolicy<IConnection>, ConnectionPooledObjectPolicy>();
services.AddSingleton<IEasyCachingBus, DefaultRabbitMQBus>();
}

/// <summary>
/// Withs the services.
/// </summary>
/// <param name="services">Services.</param>
public void WithServices(IApplicationBuilder services)
{
// Method intentionally left empty.
}
}
}
Loading