Skip to content

Commit 4821613

Browse files
committed
Update old documentation and clean up obsolete files
Deleted: - doc/configuration/connectionstring-configuration.md (empty/incomplete) - doc/serializers/utf8.md (wrong title, serializer abandoned) Fixed wrong titles: - doc/serializers/protobuf.md: "Jil" → "Protobuf" - doc/serializers/memoryPack.md: "Jil" → "MemoryPack" Modernized to .NET 8+ patterns (11 files): - Replaced Startup.cs with Program.cs minimal hosting in ASP.NET Core docs - Replaced .Db0 property access with IRedisDatabase DI injection - Fixed JSON syntax errors in json-configuration.md - Fixed UseRedisInformation typo in expose-redis-information.md - Added compression packages and v12 features to packages.md - Added links to new feature docs (Geo, Streams, Compression, etc.) - Updated setup-1.md: removed Jil, added MemoryPack and compression Updated indexes: - doc/README.md: removed deleted files from table of contents - README.md: restructured documentation section with categories
1 parent 9489d88 commit 4821613

15 files changed

+328
-437
lines changed

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,20 +294,32 @@ All values stored in Redis go through the configured `ISerializer`. This means:
294294

295295
Full documentation is available in the [doc/](doc/) folder:
296296

297+
**Getting Started**
297298
- [Setup & Installation](doc/setup-1.md)
298299
- [Dependency Injection](doc/dependency-injection.md)
299-
- [Configuration](doc/configuration/README.md)
300-
- [Serializers](doc/serializers/README.md)
301-
- [Compressors](doc/compressors.md)
302-
- [Usage Guide](doc/usage/README.md)
303-
- [GeoSpatial](doc/geospatial.md)
304-
- [Streams](doc/streams.md)
305-
- [Pub/Sub](doc/pubsub.md)
306-
- [Hash Field Expiry](doc/hash-field-expiry.md)
300+
- [ASP.NET Core Integration](doc/asp.net-core/README.md)
301+
302+
**Configuration**
303+
- [Configuration Overview](doc/configuration/README.md)[JSON](doc/configuration/json-configuration.md) | [C#](doc/configuration/c-configuration.md) | [Connection Pool](doc/configuration/connection-pool.md)
304+
305+
**Serializers**
306+
- [Serializers Overview](doc/serializers/README.md)[System.Text.Json](doc/serializers/system.text.json.md) | [Newtonsoft](doc/serializers/newtonsoft-json.net.md) | [MemoryPack](doc/serializers/memoryPack.md) | [MsgPack](doc/serializers/msgpack.md) | [Protobuf](doc/serializers/protobuf.md)
307+
308+
**Features**
309+
- [Usage Guide](doc/usage/README.md) — Add, Get, Replace, Bulk operations
310+
- [GeoSpatial Indexes](doc/geospatial.md)
311+
- [Redis Streams](doc/streams.md)
312+
- [Pub/Sub Messaging](doc/pubsub.md)
313+
- [Hash Field Expiry](doc/hash-field-expiry.md) (Redis 7.4+)
314+
- [Compression](doc/compressors.md) — GZip, Brotli, LZ4, Snappy, Zstandard
315+
316+
**Advanced**
317+
- [Logging & Diagnostics](doc/logging.md)
307318
- [Multiple Redis Servers](doc/multipleServers.md)
308319
- [Azure Managed Identity](doc/azure-managed-identity.md)
309320
- [OpenTelemetry](doc/openTelemetry.md)
310-
- [ASP.NET Core Middleware](doc/asp.net-core/README.md)
321+
- [Redis Information Middleware](doc/asp.net-core/expose-redis-information.md)
322+
- [NuGet Packages](doc/packages.md)
311323

312324
## Contributing
313325

doc/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* [Configuration Overview](configuration/README.md)
1111
* [JSON Configuration](configuration/json-configuration.md)
1212
* [C# Configuration](configuration/c-configuration.md)
13-
* [Connection String](configuration/connectionstring-configuration.md)
1413
* [Connection Pool](configuration/connection-pool.md)
1514

1615
## Serializers
@@ -21,7 +20,6 @@
2120
* [MemoryPack](serializers/memoryPack.md)
2221
* [MsgPack](serializers/msgpack.md)
2322
* [Protobuf](serializers/protobuf.md)
24-
* [Utf8Json](serializers/utf8.md)
2523

2624
## Compression
2725

doc/asp.net-core/README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
11
# ASP.NET Core
22

3-
If you are running into ASP.NET Core application, there is a specific package that you can use in order to make StackExchange.Redis.Extensions configuration easier.
3+
If you are running an ASP.NET Core application, there is a specific package that makes StackExchange.Redis.Extensions configuration easier.
44

5-
{% tabs %}
6-
{% tab title="PackageManager" %}
7-
```bash
8-
Install-Package StackExchange.Redis.Extensions.AspNetCore
9-
```
10-
{% endtab %}
5+
### Install
116

12-
{% tab title=".NET Cli" %}
137
```bash
148
dotnet add package StackExchange.Redis.Extensions.AspNetCore
159
```
16-
{% endtab %}
1710

18-
{% tab title="Package Reference" %}
1911
```xml
20-
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="6.1.0" />
21-
```
22-
{% endtab %}
23-
24-
{% tab title="Paket cli" %}
25-
```bash
26-
paket add StackExchange.Redis.Extensions.AspNetCore
12+
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="12.*" />
2713
```
28-
{% endtab %}
29-
{% endtabs %}
3014

31-
### Startup.cs
15+
### Program.cs
3216

33-
Into your startup class,&#x20;
17+
Register the library in your `Program.cs` using the minimal hosting model:
3418

3519
```csharp
36-
public void ConfigureServices(IServiceCollection services)
37-
{
38-
// Retrieve the configuration fro your json/xml file
20+
var builder = WebApplication.CreateBuilder(args);
21+
22+
var redisConfiguration = builder.Configuration
23+
.GetSection("Redis")
24+
.Get<RedisConfiguration>();
25+
26+
builder.Services.AddStackExchangeRedisExtensions<SystemTextJsonSerializer>(redisConfiguration);
27+
28+
var app = builder.Build();
29+
30+
app.UseRedisInformation();
3931

40-
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(conf);
41-
}I
32+
app.Run();
4233
```
4334

4435
{% hint style="info" %}
45-
Remember to install also you favorite serializer.
36+
Remember to install your preferred serializer package as well (e.g., `StackExchange.Redis.Extensions.System.Text.Json`).
4637
{% endhint %}
4738

39+
### Adding Compression (optional)
40+
41+
You can optionally enable transparent compression by calling `AddRedisCompression` right after `AddStackExchangeRedisExtensions`:
42+
4843
```csharp
49-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
50-
{
51-
app.UseRedisInformation();
52-
}
44+
builder.Services.AddStackExchangeRedisExtensions<SystemTextJsonSerializer>(redisConfiguration);
45+
builder.Services.AddRedisCompression<LZ4Compressor>();
5346
```
5447

48+
See the [Compression](../compressors.md) page for all available compressors and configuration options.
49+
50+
### Injecting IRedisDatabase
51+
52+
Once registered, you can inject `IRedisDatabase` directly into your controllers, services, or minimal API handlers:
53+
54+
```csharp
55+
app.MapGet("/users/{key}", async (string key, IRedisDatabase redis) =>
56+
{
57+
var user = await redis.GetAsync<User>(key);
58+
return user is not null ? Results.Ok(user) : Results.NotFound();
59+
});
60+
```
Lines changed: 27 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# Expose redis information
1+
# Expose Redis Information
22

3-
Sometimes is helpfull to expose the redis information outside of you application, like a json endpoint, in order to monitor the connection, the status of the server an so on.
3+
Sometimes it is helpful to expose Redis information outside of your application as a JSON endpoint, in order to monitor the connection, the status of the server, and so on.
44

55
For this we have created a specific middleware that you can use like this:
66

77
```csharp
8-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
9-
{
10-
app.UseRedisInformation();
11-
}
8+
var app = builder.Build();
9+
10+
app.UseRedisInformation();
11+
12+
app.Run();
1213
```
1314

14-
From now, you have two endpoint availables:
15+
From now on, you have two endpoints available:
1516

16-
**edis information "/redis/connectionInfo"**
17+
**Connection information "/redis/connectionInfo"**
1718

1819
```json
1920
{
@@ -28,149 +29,42 @@ From now, you have two endpoint availables:
2829

2930
```json
3031
{
31-
"redis_version": "5.0.7",
32-
"redis_git_sha1": "00000000",
33-
"redis_git_dirty": "0",
34-
"redis_build_id": "5f6bfe2b13cc4617",
32+
"redis_version": "7.2.4",
3533
"redis_mode": "standalone",
36-
"os": "Linux 4.19.76-linuxkit x86_64",
34+
"os": "Linux 6.1.0 x86_64",
3735
"arch_bits": "64",
38-
"multiplexing_api": "epoll",
39-
"atomicvar_api": "atomic-builtin",
40-
"gcc_version": "8.3.0",
41-
"process_id": "1",
42-
"run_id": "ed1b72b1d1744c414f3fc2495f298ac033f787c6",
4336
"tcp_port": "6379",
4437
"uptime_in_seconds": "34131",
4538
"uptime_in_days": "0",
46-
"hz": "10",
47-
"configured_hz": "10",
48-
"lru_clock": "10956504",
49-
"executable": "/data/redis-server",
50-
"config_file": "",
5139
"connected_clients": "2",
52-
"client_recent_max_input_buffer": "2",
53-
"client_recent_max_output_buffer": "0",
54-
"blocked_clients": "0",
55-
"used_memory": "1732288",
5640
"used_memory_human": "1.65M",
57-
"used_memory_rss": "5775360",
58-
"used_memory_rss_human": "5.51M",
59-
"used_memory_peak": "1834480",
6041
"used_memory_peak_human": "1.75M",
61-
"used_memory_peak_perc": "94.43%",
62-
"used_memory_overhead": "858352",
63-
"used_memory_startup": "791264",
64-
"used_memory_dataset": "873936",
65-
"used_memory_dataset_perc": "92.87%",
66-
"allocator_allocated": "1804256",
67-
"allocator_active": "2080768",
68-
"allocator_resident": "4820992",
69-
"total_system_memory": "2086522880",
70-
"total_system_memory_human": "1.94G",
71-
"used_memory_lua": "34816",
72-
"used_memory_lua_human": "34.00K",
73-
"used_memory_scripts": "136",
74-
"used_memory_scripts_human": "136B",
75-
"number_of_cached_scripts": "1",
76-
"maxmemory": "0",
77-
"maxmemory_human": "0B",
7842
"maxmemory_policy": "noeviction",
79-
"allocator_frag_ratio": "1.15",
80-
"allocator_frag_bytes": "276512",
81-
"allocator_rss_ratio": "2.32",
82-
"allocator_rss_bytes": "2740224",
83-
"rss_overhead_ratio": "1.20",
84-
"rss_overhead_bytes": "954368",
85-
"mem_fragmentation_ratio": "3.42",
86-
"mem_fragmentation_bytes": "4085176",
87-
"mem_not_counted_for_evict": "0",
88-
"mem_replication_backlog": "0",
89-
"mem_clients_slaves": "0",
90-
"mem_clients_normal": "66616",
91-
"mem_aof_buffer": "0",
92-
"mem_allocator": "jemalloc-5.1.0",
93-
"active_defrag_running": "0",
94-
"lazyfree_pending_objects": "0",
95-
"loading": "0",
96-
"rdb_changes_since_last_save": "0",
97-
"rdb_bgsave_in_progress": "0",
98-
"rdb_last_save_time": "1587980677",
99-
"rdb_last_bgsave_status": "ok",
100-
"rdb_last_bgsave_time_sec": "-1",
101-
"rdb_current_bgsave_time_sec": "-1",
102-
"rdb_last_cow_size": "0",
103-
"aof_enabled": "0",
104-
"aof_rewrite_in_progress": "0",
105-
"aof_rewrite_scheduled": "0",
106-
"aof_last_rewrite_time_sec": "-1",
107-
"aof_current_rewrite_time_sec": "-1",
108-
"aof_last_bgrewrite_status": "ok",
109-
"aof_last_write_status": "ok",
110-
"aof_last_cow_size": "0",
111-
"total_connections_received": "10",
112-
"total_commands_processed": "86",
113-
"instantaneous_ops_per_sec": "0",
114-
"total_net_input_bytes": "3307",
115-
"total_net_output_bytes": "27046",
116-
"instantaneous_input_kbps": "0.00",
117-
"instantaneous_output_kbps": "0.00",
118-
"rejected_connections": "0",
119-
"sync_full": "0",
120-
"sync_partial_ok": "0",
121-
"sync_partial_err": "0",
122-
"expired_keys": "0",
123-
"expired_stale_perc": "0.00",
124-
"expired_time_cap_reached_count": "0",
125-
"evicted_keys": "0",
126-
"keyspace_hits": "0",
127-
"keyspace_misses": "10",
128-
"pubsub_channels": "1",
129-
"pubsub_patterns": "0",
130-
"latest_fork_usec": "0",
131-
"migrate_cached_sockets": "0",
132-
"slave_expires_tracked_keys": "0",
133-
"active_defrag_hits": "0",
134-
"active_defrag_misses": "0",
135-
"active_defrag_key_hits": "0",
136-
"active_defrag_key_misses": "0",
13743
"role": "master",
13844
"connected_slaves": "0",
139-
"master_replid": "c5395946e2c8303b9e256aad1ae5919c0721132f",
140-
"master_replid2": "0000000000000000000000000000000000000000",
141-
"master_repl_offset": "0",
142-
"second_repl_offset": "-1",
143-
"repl_backlog_active": "0",
144-
"repl_backlog_size": "1048576",
145-
"repl_backlog_first_byte_offset": "0",
146-
"repl_backlog_histlen": "0",
147-
"used_cpu_sys": "31.233827",
148-
"used_cpu_user": "21.267245",
149-
"used_cpu_sys_children": "0.008739",
150-
"used_cpu_user_children": "0.003207",
151-
"cluster_enabled": "0",
152-
"db6": "keys=6,expires=0,avg_ttl=0"
45+
"cluster_enabled": "0"
15346
}
15447
```
15548

156-
Of course these responses could contains sensilbe data, for this reason you can allow access only to a specific set of IP Addresses of you custom login.
49+
Of course these responses could contain sensitive data, so you can restrict access to a specific set of IP addresses or apply your own custom authorization logic:
15750

15851
```csharp
159-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
52+
var app = builder.Build();
53+
54+
app.UseRedisInformation(options =>
16055
{
161-
app.UserRedisInformation(x =>
56+
options.AllowedIPs = Array.Empty<IPAddress>();
57+
// AllowFunction has higher priority than AllowedIPs if not null.
58+
options.AllowFunction = (HttpContext ctx) =>
16259
{
163-
x.AllowedIPs = Array.Empty<IPAddress>();
164-
// `AllowFunction` has higher priority than `AllowedIPs` if not null.
165-
x.AllowFunction = (HttpContext ctx) =>
166-
{
167-
// My custom logic.
168-
return true;
169-
};
170-
});
171-
}
60+
// Your custom authorization logic.
61+
return true;
62+
};
63+
});
64+
65+
app.Run();
17266
```
17367

174-
**Warnings**:
68+
**Warnings**:
17569

176-
Since 11.0, the `RedisInformationMiddleware` has some break changes. See [issue#430](https://github.com/imperugo/StackExchange.Redis.Extensions/issues/430) for details.
70+
Since 11.0, the `RedisInformationMiddleware` has some breaking changes. See [issue #430](https://github.com/imperugo/StackExchange.Redis.Extensions/issues/430) for details.

doc/configuration/connectionstring-configuration.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)