AsyncRedisDocuments 1.0.0.7
See the version list below for details.
dotnet add package AsyncRedisDocuments --version 1.0.0.7
NuGet\Install-Package AsyncRedisDocuments -Version 1.0.0.7
<PackageReference Include="AsyncRedisDocuments" Version="1.0.0.7" />
paket add AsyncRedisDocuments --version 1.0.0.7
#r "nuget: AsyncRedisDocuments, 1.0.0.7"
// Install AsyncRedisDocuments as a Cake Addin #addin nuget:?package=AsyncRedisDocuments&version=1.0.0.7 // Install AsyncRedisDocuments as a Cake Tool #tool nuget:?package=AsyncRedisDocuments&version=1.0.0.7
Available on Nuget
nuget install AsyncRedisDocuments
This system provides a set of components and patterns for managing documents and related data structures in a Redis-backed document storage system. It allows for flexibility, scalability, and easy integration into various types of applications.
Key Concepts & Components
- AsyncProperty
AsyncProperty
represents an asynchronous property on a document or object, simplifying the loading and saving of values to a Redis database. It supports complex types, time stamps, and other custom types, and automatically handles the conversion of values to and from Redis.Example:
public class Car : IAsyncDocument
{
[Indexed]
public AsyncProperty<string> Description => new(this);
[Unique]
public AsyncProperty<string> DisplayName => new(this);
public string Id { get; set; }
public string IndexName() => "cars";
}
- AsyncDictionary<TKey, TValue>
AsyncDictionary
provides a way to store and manage a dictionary-like structure in Redis, using keys and values. Operations include adding, removing, checking for keys, and getting values asynchronously.Example:
var carDictionary = new AsyncDictionary<string, Car>();
await carDictionary.SetAsync("car1", carObject);
var car = await carDictionary.GetByKeyAsync("car1");
- AsyncLink<TDocument>**
AsyncLink
represents a reference (or link) to another document. It stores the ID of the linked document and provides methods to get and set the linked document asynchronously.Example:
public class Car : IAsyncDocument
{
public AsyncLink<Owner> OwnerLink { get; set; }
public string Id { get; set; }
public string IndexName() => "cars";
}
public class Owner : IAsyncDocument
{
public string Name { get; set; }
public string Id { get; set; }
public string IndexName() => "owners";
}
- ManagedLink<TDocument>**
ManagedLink
is an extension ofAsyncLink
that adds additional functionality, such as automatically deleting the linked document when the link is changed or cleared.Example:
var carLink = new ManagedLink<Car>();
await carLink.SetAsync("car123");
- AsyncLinkSet<TDocument>**
AsyncLinkSet
is used to manage a set of links (referencing multiple documents) in Redis. It allows operations like adding, removing, and querying links asynchronously.Example:
var linkSet = new AsyncLinkSet<Car>();
await linkSet.AddOrUpdateAsync(carObject);
- ManagedLinkSet<TDocument>**
ManagedLinkSet
extendsAsyncLinkSet
by providing additional functionality to automatically delete linked documents when they are removed from the set.Example:
await linkSet.SetAsync(new List<Car> { carObject1, carObject2 });
- StaticLink<TDocument>**
StaticLink
represents a reference to another document, where the linked document cannot be modified. This class is used for managing static, non-modifiable relationships.Example:
var staticLink = new StaticLink<Car>();
await staticLink.DeleteAsync();
- AsyncList<TKey>**
AsyncList
provides a way to store and manage a set of values in Redis. It allows operations like adding, removing, and querying items asynchronously, as well as managing the set size.Example:
var asyncList = new AsyncList<string>();
await asyncList.AddAsync("value1");
await asyncList.RemoveAsync("value1");
- GlobalSettings Global settings provide a simple way to manage global application settings without the need for document-specific configuration.
GlobalSettings
allows you to store key-value pairs globally, independent of any document.Example:
public class GlobalSettings
{
public AsyncProperty<string> Setting1 => new AsyncProperty<string>();
public AsyncProperty<int> Setting2 => new AsyncProperty<int>();
}
var globalSettings = new GlobalSettings();
await globalSettings.Setting1.SetAsync("Some setting value");
await globalSettings.Setting2.SetAsync(42);
- Querying Documents The system supports querying documents using LINQ and custom query strings. You can easily build queries to search for documents based on various criteria, and return paginated results. Example:
var query = QueryBuilder.Query<Car>(x => x.Description.Contains("Sedan"));
var results = await query.ToPagedListAsync<Car>(page: 1, pageSize: 10);
QueryBuilder
Query<TDocument>
: Build a query for a specific document type.Query<TDocument>(Expression<Func<TDocument, bool>> expression)
: Converts a LINQ expression into a Redis query. Example Query Usage:
var query = QueryBuilder.Query<Car>(x => x.DisplayName.Contains("Tesla"));
var results = await query.ToPagedListAsync<Car>(1, 10);
Redis Query Extensions
The system includes various extension methods to simplify working with Redis queries:
ToPagedListAsync<TDocument>()
: Paginates results and returns documents, total count, and total pages.ToListAsync<TDocument>()
: Returns a list of documents matching the query.AnyAsync<TDocument>()
: Checks if any document matches the query.SelectAsync<TDocument>()
: Selects specific fields from documents based on LINQ expressions.PagedSelectAsync<TDocument>()
: Paginates results while selecting specific fields.
Authors
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
- RediSearchClient (>= 2.4.0)
- StackExchange.Redis (>= 2.8.24)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AsyncRedisDocuments:
Package | Downloads |
---|---|
BetterRedisIdentity
A better way to use Redis and Identity together. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.0.19 | 36 | 2/18/2025 | |
1.0.0.18 | 49 | 2/17/2025 | |
1.0.0.17 | 71 | 2/17/2025 | |
1.0.0.16 | 77 | 2/17/2025 | |
1.0.0.15 | 75 | 2/17/2025 | |
1.0.0.14 | 79 | 2/17/2025 | |
1.0.0.13 | 86 | 2/16/2025 | |
1.0.0.12 | 72 | 2/16/2025 | |
1.0.0.11 | 71 | 2/16/2025 | |
1.0.0.10 | 71 | 2/16/2025 | |
1.0.0.9 | 73 | 2/16/2025 | |
1.0.0.8 | 77 | 2/16/2025 | |
1.0.0.7 | 89 | 2/16/2025 | |
1.0.0.6 | 74 | 2/16/2025 | |
1.0.0.5 | 96 | 2/10/2025 | |
1.0.0.4 | 79 | 2/10/2025 | |
1.0.0.3 | 80 | 2/10/2025 | |
1.0.0.2 | 87 | 2/9/2025 | |
1.0.0.1 | 77 | 2/8/2025 | |
1.0.0 | 83 | 2/8/2025 |