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
10 changes: 2 additions & 8 deletions build/releasenotes.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
7. Modify some extension methods' namespace.
</EasyCachingMemcachedPackageNotes>
<EasyCachingRedisPackageNotes>
1. Make Interceptors and response caching Support .netcore3.0.
2. Remove WithServices method to support console apps.
3. Improve RabbitMQ bus.
4. Add deep clone for memory cache provider.
5. Support multi instances of hybrid provider.
6. Upgrading dependencies.
7. Modify some extension methods' namespace.
1. Support Hyperloglog.
</EasyCachingRedisPackageNotes>
<EasyCachingSQLitePackageNotes>
1. Make Interceptors and response caching Support .netcore3.0.
Expand Down Expand Up @@ -91,7 +85,7 @@
7. Modify some extension methods' namespace.
</EasyCachingProtobufPackageNotes>
<EasyCachingCSRedisPackageNotes>
1. Support sentinel mode.
1. Support Hyperloglog.
</EasyCachingCSRedisPackageNotes>
<EasyCachingCSRedisBusPackageNotes>
1. Support sentinel mode.
Expand Down
4 changes: 2 additions & 2 deletions build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<EasyCachingCorePackageVersion>0.8.0</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>0.8.0</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>0.8.0</EasyCachingRedisPackageVersion>
<EasyCachingRedisPackageVersion>0.8.2</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>0.8.0</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>0.8.0</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>0.8.1</EasyCachingHybridPackageVersion>
Expand All @@ -12,7 +12,7 @@
<EasyCachingJsonPackageVersion>0.8.1</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>0.8.1</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>0.8.0</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>0.8.1</EasyCachingCSRedisPackageVersion>
<EasyCachingCSRedisPackageVersion>0.8.2</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>0.8.0</EasyCachingRedisBusPackageVersion>
<EasyCachingCSRedisBusPackageVersion>0.8.1</EasyCachingCSRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>0.8.0</EasyCachingRabbitBusPackageVersion>
Expand Down
45 changes: 45 additions & 0 deletions code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# MEMBER CODE OF CONDUCT

The .NET Core Community (NCC) was created to doster an open, innovative, inclusive and welcoming community around open source .NET/.NET Core. To clarify expected behaviour in our communities we have adopted the [Contributor Covenant](contributor-covenant.org). This code of conduct has been adopted by [many other open source communities](contributor-covenant.org/adopters) and we feel it expresses our values well.

### Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

### Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [dotnet-community@outlook.com](dotnet-community@outlook.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

### Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
namespace EasyCaching.CSRedis
{
using EasyCaching.Core;
using System.Collections.Generic;
using System.Threading.Tasks;

public partial class DefaultCSRedisCachingProvider : IRedisCachingProvider
{
public bool PfAdd<T>(string cacheKey, List<T> values)
{
ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
ArgumentCheck.NotNullAndCountGTZero(values, nameof(values));

var list = new List<byte[]>();

foreach (var item in values)
{
list.Add(_serializer.Serialize(item));
}

var res = _cache.PfAdd(cacheKey, list.ToArray());
return res;
}

public async Task<bool> PfAddAsync<T>(string cacheKey, List<T> values)
{
ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
ArgumentCheck.NotNullAndCountGTZero(values, nameof(values));

var list = new List<byte[]>();

foreach (var item in values)
{
list.Add(_serializer.Serialize(item));
}

var res = await _cache.PfAddAsync(cacheKey, list.ToArray());
return res;
}

[System.Obsolete()]
public long PfCount(List<string> cacheKeys)
{
ArgumentCheck.NotNullAndCountGTZero(cacheKeys, nameof(cacheKeys));

var res = _cache.PfCount(cacheKeys.ToArray());
return res;
}

[System.Obsolete()]
public async Task<long> PfCountAsync(List<string> cacheKeys)
{
ArgumentCheck.NotNullAndCountGTZero(cacheKeys, nameof(cacheKeys));

var res = await _cache.PfCountAsync(cacheKeys.ToArray());
return res;
}

[System.Obsolete()]
public bool PfMerge(string destKey, List<string> sourceKeys)
{
ArgumentCheck.NotNullOrWhiteSpace(destKey, nameof(destKey));
ArgumentCheck.NotNullAndCountGTZero(sourceKeys, nameof(sourceKeys));

var res = _cache.PfMerge(destKey, sourceKeys.ToArray());
return res;
}

[System.Obsolete()]
public async Task<bool> PfMergeAsync(string destKey, List<string> sourceKeys)
{
ArgumentCheck.NotNullOrWhiteSpace(destKey, nameof(destKey));
ArgumentCheck.NotNullAndCountGTZero(sourceKeys, nameof(sourceKeys));

var res = await _cache.PfMergeAsync(destKey, sourceKeys.ToArray());
return res;
}
}
}
48 changes: 47 additions & 1 deletion src/EasyCaching.Core/IRedisCachingProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,53 @@ public interface IRedisCachingProvider
/// <param name="cacheKey"></param>
/// <param name="cacheValue"></param>
/// <returns></returns>
Task<double?> ZScoreAsync<T>(string cacheKey, T cacheValue);
Task<double?> ZScoreAsync<T>(string cacheKey, T cacheValue);
#endregion


#region Hyperloglog
/// <summary>
/// https://redis.io/commands/pfadd
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="cacheKey"></param>
/// <param name="values"></param>
/// <returns></returns>
bool PfAdd<T>(string cacheKey, List<T> values);
/// <summary>
/// https://redis.io/commands/pfadd
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="cacheKey"></param>
/// <param name="values"></param>
/// <returns></returns>
Task<bool> PfAddAsync<T>(string cacheKey, List<T> values);
/// <summary>
/// https://redis.io/commands/pfcount
/// </summary>
/// <param name="cacheKeys"></param>
/// <returns></returns>
long PfCount(List<string> cacheKeys);
/// <summary>
/// https://redis.io/commands/pfcount
/// </summary>
/// <param name="cacheKeys"></param>
/// <returns></returns>
Task<long> PfCountAsync(List<string> cacheKeys);
/// <summary>
/// https://redis.io/commands/pfmerge
/// </summary>
/// <param name="destKey"></param>
/// <param name="sourceKeys"></param>
/// <returns></returns>
bool PfMerge(string destKey, List<string> sourceKeys);
/// <summary>
/// https://redis.io/commands/pfmerge
/// </summary>
/// <param name="destKey"></param>
/// <param name="sourceKeys"></param>
/// <returns></returns>
Task<bool> PfMergeAsync(string destKey, List<string> sourceKeys);
#endregion
}
}
110 changes: 110 additions & 0 deletions src/EasyCaching.Redis/DefaultRedisCachingProvider.Hyperloglog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
namespace EasyCaching.Redis
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyCaching.Core;
using EasyCaching.Core.Internal;
using StackExchange.Redis;

/// <summary>
/// Default redis caching provider.
/// </summary>
public partial class DefaultRedisCachingProvider : IRedisCachingProvider
{
public bool PfAdd<T>(string cacheKey, List<T> values)
{
ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
ArgumentCheck.NotNullAndCountGTZero(values, nameof(values));

var list = new List<RedisValue>();

foreach (var item in values)
{
list.Add(_serializer.Serialize(item));
}

var res = _cache.HyperLogLogAdd(cacheKey, list.ToArray());
return res;
}

public async Task<bool> PfAddAsync<T>(string cacheKey, List<T> values)
{
ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
ArgumentCheck.NotNullAndCountGTZero(values, nameof(values));

var list = new List<RedisValue>();

foreach (var item in values)
{
list.Add(_serializer.Serialize(item));
}

var res = await _cache.HyperLogLogAddAsync(cacheKey, list.ToArray());
return res;
}

public long PfCount(List<string> cacheKeys)
{
ArgumentCheck.NotNullAndCountGTZero(cacheKeys, nameof(cacheKeys));

var list = new List<RedisKey>();

foreach (var item in cacheKeys)
{
list.Add(item);
}

var res = _cache.HyperLogLogLength(list.ToArray());
return res;
}

public async Task<long> PfCountAsync(List<string> cacheKeys)
{
ArgumentCheck.NotNullAndCountGTZero(cacheKeys, nameof(cacheKeys));

var list = new List<RedisKey>();

foreach (var item in cacheKeys)
{
list.Add(item);
}

var res = await _cache.HyperLogLogLengthAsync(list.ToArray());
return res;
}

public bool PfMerge(string destKey, List<string> sourceKeys)
{
ArgumentCheck.NotNullOrWhiteSpace(destKey, nameof(destKey));
ArgumentCheck.NotNullAndCountGTZero(sourceKeys, nameof(sourceKeys));

var list = new List<RedisKey>();

foreach (var item in sourceKeys)
{
list.Add(item);
}

_cache.HyperLogLogMerge(destKey, list.ToArray());
return true;
}

public async Task<bool> PfMergeAsync(string destKey, List<string> sourceKeys)
{
ArgumentCheck.NotNullOrWhiteSpace(destKey, nameof(destKey));
ArgumentCheck.NotNullAndCountGTZero(sourceKeys, nameof(sourceKeys));

var list = new List<RedisKey>();

foreach (var item in sourceKeys)
{
list.Add(item);
}

await _cache.HyperLogLogMergeAsync(destKey, list.ToArray());
return true;
}
}
}
Loading