From da1f35168c7d88ac7f1912adcd1206de2086d6a1 Mon Sep 17 00:00:00 2001 From: Mohammad Javad Ebrahimi Date: Thu, 8 Feb 2024 13:22:18 +0330 Subject: [PATCH] Update README.md --- .../README.md | 69 ++++++++----------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/src/EasyCaching.Extensions.EasyCompressor/README.md b/src/EasyCaching.Extensions.EasyCompressor/README.md index 443f9ac..b7a10d7 100644 --- a/src/EasyCaching.Extensions.EasyCompressor/README.md +++ b/src/EasyCaching.Extensions.EasyCompressor/README.md @@ -1,16 +1,16 @@ -[![NuGet](https://img.shields.io/nuget/v/EasyCaching.Extensions.EasyCompressor.svg)](https://www.nuget.org/packages/EasyCaching.Extensions.EasyCompressor) +[![NuGet Badge](https://buildstats.info/nuget/EasyCaching.Extensions.EasyCompressor)](https://www.nuget.org/packages/EasyCaching.Extensions.EasyCompressor) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) -[![Build Status](https://github.com/mjebrahimi/EasyCompressor/workflows/.NET%20Core/badge.svg)](https://github.com/mjebrahimi/EasyCompressor) +[![Build Status](https://github.com/mjebrahimi/EasyCompressor/workflows/.NET/badge.svg)](https://github.com/mjebrahimi/EasyCaching.Extensions.EasyCompressor) # EasyCaching.Extensions.EasyCompressor -A compressor upon [EasyCaching](https://github.com/dotnetcore/EasyCaching) serializers using [EasyCompressor](https://github.com/mjebrahimi/EasyCompressor). +A nice integration between [EasyCaching](https://github.com/dotnetcore/EasyCaching) and [EasyCompressor](https://github.com/mjebrahimi/EasyCompressor). -This library is very useful for compressing cache data especially for distributed cache (such as Redis) **to reduce network traffic and subsequently increase performance**. +This library aids in **Improving Performance** by **Reducing Memory Usage** and **Bandwidth Usage** by compressing your cache data, especially for distributed cache (such as Redis). -**EasyCaching** is the best caching abstraction library that supports many providers and serializers. +[EasyCaching](https://github.com/dotnetcore/EasyCaching) is an Easy-to-Use caching library that offers many features and supports many providers and serializers. -**EasyCompressor** is an open-source compression abstraction library that supports and implements many compression algorithms such as **Zstd, LZMA, LZ4, Snappy, Brotli, GZip and Deflate**. It is very useful for using along with **distributed caching** or **storing files in database**. +[EasyCompressor](https://github.com/mjebrahimi/EasyCompressor) is an **Easy-to-Use** and **Optimized** compression library for .NET that unified several compression algorithms including **LZ4**, **Snappy**, **Zstd**, **LZMA**, **Brotli**, **GZip**, **ZLib**, and **Deflate**. ## How to use @@ -23,29 +23,13 @@ PM> Install-Package EasyCompressor.LZ4 ### 2. Add Services -Just add your desired compressor and use `WithCompressor()` *after* serializer. -```cs -// Using Redis + BinaryFormatter serializer (default) + LZ4 compressor +#### Basic Using -services.AddLZ4Compressor(); - -services.AddEasyCaching(options => -{ - options.UseRedis(config => - { - config.DBConfig.Endpoints.Add(new ServerEndPoint("127.0.0.1", 6379)); - }) - .WithCompressor(); -}); -``` +Just add your desired compressor and use the `WithCompressor()` method *just after* the serializer. -Also, you can use multiple serializers and compressors with specifying names. - -```cs -// Using Redis provider + MessagePack serializer + LZ4 compressor. - -services.AddLZ4Compressor("lz4"); +```csharp +services.AddLZ4Compressor(); services.AddEasyCaching(options => { @@ -55,15 +39,17 @@ services.AddEasyCaching(options => config.SerializerName = "msgpack"; }) .WithMessagePack("msgpack") - .WithCompressor("msgpack", "lz4"); + .WithCompressor(); }); +``` +#### Using a specific Compressor for each Serializer. +It assigns `lz4` compressor to `msgpack` serializer and `snappier` compressor to `protobuf` serializer. -// Using multiple Serializers with each related Compressor. - +```csharp services.AddLZ4Compressor("lz4"); -services.AddZstdCompressor("zstd"); +services.AddSnappierCompressor("snappier"); services.AddEasyCaching(options => { @@ -78,24 +64,24 @@ services.AddEasyCaching(options => options.UseRedis(config => { config.DBConfig.Endpoints.Add(new ServerEndPoint("127.0.0.1", 6379)); - config.SerializerName = "json"; + config.SerializerName = "protobuf"; }, "redis2") - .WithJson("json") - .WithCompressor("json", "zstd"); + .WithProtobuf("protobuf") + .WithCompressor("protobuf", "snappier"); }); ``` -This will use `lz4` compressor for `msgpack` serializer and `zstd` compressor for `json` serializer. - -## Benchmark +## Benchmarks -You can see benchmark of serializers [here](https://github.com/mjebrahimi/EasyCompressor#benchmark). +You can see the benchmark of compressors [here](https://github.com/mjebrahimi/EasyCompressor#benchmarks). ## Contributing -Create an [issue](https://github.com/mjebrahimi/EasyCompressor/issues/new) if you find a BUG or have a Suggestion or Question. If you want to develop this project : +Create an [issue](https://github.com/mjebrahimi/EasyCompressor/issues/new) if you found a **BUG** or have a **Suggestion** or **Question**. -1. Fork it! +**Or if you want to develop this project:** + +1. Fork it 2. Create your feature branch: `git checkout -b my-new-feature` 3. Commit your changes: `git commit -am 'Add some feature'` 4. Push to the branch: `git push origin my-new-feature` @@ -103,9 +89,8 @@ Create an [issue](https://github.com/mjebrahimi/EasyCompressor/issues/new) if yo ## Give a Star! ⭐️ -If you find this repository useful, please give it a star. Thanks! +If you find this repository useful and like it, why not give it a star? if not, never mind! :) ## License -EasyCompressor is Copyright © 2020 [Mohammd Javad Ebrahimi](https://github.com/mjebrahimi) under the [MIT License](https://github.com/mjebrahimi/EasyCompressor/LICENSE). - +Copyright © 2020 [Mohammd Javad Ebrahimi](https://github.com/mjebrahimi) under the [MIT License](https://github.com/mjebrahimi/EasyCompressor/LICENSE).