Show / Hide Table of Contents

Class RedisCollection<T>

Collection of items in Redis, can be queried using it's fluent interface.

Inheritance
System.Object
RedisCollection<T>
Implements
IRedisCollection<T>
System.Linq.IOrderedQueryable<T>
System.Linq.IOrderedQueryable
System.Linq.IQueryable<T>
System.Collections.Generic.IEnumerable<T>
System.Linq.IQueryable
System.Collections.IEnumerable
System.Collections.Generic.IAsyncEnumerable<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Redis.OM.Searching
Assembly: Redis.OM.dll
Syntax
public class RedisCollection<T> : IRedisCollection<T>, IOrderedQueryable<T>, IOrderedQueryable, IQueryable<T>, IEnumerable<T>, IQueryable, IEnumerable, IAsyncEnumerable<T>
Type Parameters
Name Description
T

The type being stored in Redis.

Constructors

| Improve this Doc View Source

RedisCollection(IRedisConnection, Int32)

Initializes a new instance of the RedisCollection<T> class.

Declaration
public RedisCollection(IRedisConnection connection, int chunkSize = 100)
Parameters
Type Name Description
IRedisConnection connection

Connection to Redis.

System.Int32 chunkSize

Size of chunks to pull back during pagination, defaults to 100.

Properties

| Improve this Doc View Source

ChunkSize

Gets the size of chunks to use when paginating.

Declaration
public int ChunkSize { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

ElementType

Declaration
public Type ElementType { get; }
Property Value
Type Description
System.Type
| Improve this Doc View Source

Expression

Declaration
public Expression Expression { get; }
Property Value
Type Description
System.Linq.Expressions.Expression
| Improve this Doc View Source

Provider

Declaration
public IQueryProvider Provider { get; }
Property Value
Type Description
System.Linq.IQueryProvider
| Improve this Doc View Source

StateManager

Gets manages the state of the items queried from Redis.

Declaration
public RedisCollectionStateManager StateManager { get; }
Property Value
Type Description
RedisCollectionStateManager

Methods

| Improve this Doc View Source

Any(Expression<Func<T, Boolean>>)

Checks to see if anything matching the expression exists.

Declaration
public bool Any(Expression<Func<T, bool>> expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> expression

the expression to be matched.

Returns
Type Description
System.Boolean

Whether anything matching the expression was found.

| Improve this Doc View Source

Delete(T)

Deletes the item from Redis.

Declaration
public async Task Delete(T item)
Parameters
Type Name Description
T item

The item to be deleted.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task representing the asynchronous operation.

| Improve this Doc View Source

FindById(String)

finds an item by it's ID.

Declaration
public T FindById(string id)
Parameters
Type Name Description
System.String id

the id to lookup.

Returns
Type Description
T

the item if it's present.

| Improve this Doc View Source

FindByIdAsync(String)

finds an item by it's ID.

Declaration
public async Task<T> FindByIdAsync(string id)
Parameters
Type Name Description
System.String id

the id to lookup.

Returns
Type Description
System.Threading.Tasks.Task<T>

the item if it's present.

| Improve this Doc View Source

GetAsyncEnumerator(CancellationToken)

Declaration
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Collections.Generic.IAsyncEnumerator<T>
| Improve this Doc View Source

GetEnumerator()

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

Insert(T)

Inserts an item into redis.

Declaration
public string Insert(T item)
Parameters
Type Name Description
T item

an item.

Returns
Type Description
System.String

the key.

| Improve this Doc View Source

InsertAsync(T)

Inserts an item into redis.

Declaration
public async Task<string> InsertAsync(T item)
Parameters
Type Name Description
T item

an item.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

the key.

| Improve this Doc View Source

Save()

Saves the current state of the collection, overriding what was initially materialized.

Declaration
public void Save()
| Improve this Doc View Source

SaveAsync()

Saves the current state of the collection, overriding what was initially materialized.

Declaration
public async ValueTask SaveAsync()
Returns
Type Description
System.Threading.Tasks.ValueTask

a value task.

| Improve this Doc View Source

Update(T)

Updates the provided item in Redis. Document must have a property marked with the RedisIdFieldAttribute.

Declaration
public async Task Update(T item)
Parameters
Type Name Description
T item

The item to update.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task representing the asynchronous operation.

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

IRedisCollection<T>
System.Linq.IOrderedQueryable<T>
System.Linq.IOrderedQueryable
System.Linq.IQueryable<T>
System.Collections.Generic.IEnumerable<T>
System.Linq.IQueryable
System.Collections.IEnumerable
System.Collections.Generic.IAsyncEnumerable<T>

Extension Methods

SearchExtensions.Where<T>(IRedisCollection<T>, Expression<Func<T, Boolean>>)
SearchExtensions.Select<T, TR>(IRedisCollection<T>, Expression<Func<T, TR>>)
SearchExtensions.Skip<T>(IRedisCollection<T>, Int32)
SearchExtensions.Take<T>(IRedisCollection<T>, Int32)
SearchExtensions.GeoFilter<T>(IRedisCollection<T>, Expression<Func<T, Nullable<GeoLoc>>>, Double, Double, Double, GeoLocDistanceUnit)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX