Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mjebrahimi authored Feb 8, 2024
1 parent 019b8d7 commit da1f351
Showing 1 changed file with 27 additions and 42 deletions.
69 changes: 27 additions & 42 deletions src/EasyCaching.Extensions.EasyCompressor/README.md
Original file line number Diff line number Diff line change
@@ -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).
<img src="/src/EasyCompressor.png" width="100" height="100" align="left"/>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

Expand All @@ -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 =>
{
Expand All @@ -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 =>
{
Expand All @@ -78,34 +64,33 @@ 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`
5. Submit a pull request

## 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).

0 comments on commit da1f351

Please sign in to comment.