Show / Hide Table of Contents

Class RedisCommands

Extension methods for redis commands.

Inheritance
System.Object
RedisCommands
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
Assembly: Redis.OM.dll
Syntax
public static class RedisCommands

Methods

| Improve this Doc View Source

CreateAndEval(IRedisConnection, String, String[], String[], String)

Creates an evaluates a script.

Declaration
public static int? CreateAndEval(this IRedisConnection connection, string scriptName, string[] keys, string[] argv, string fullScript = "")
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String scriptName

the script's name.

System.String[] keys

the keys to use.

System.String[] argv

the arguments to use.

System.String fullScript

the full script.

Returns
Type Description
System.Nullable<System.Int32>

the result.

Exceptions
Type Condition
System.ArgumentException

Thrown if the script cannot be resolved either the script is empty or the script name has not been encountered.

| Improve this Doc View Source

CreateAndEvalAsync(IRedisConnection, String, String[], String[], String)

Creates an evaluates a script.

Declaration
public static async Task<int?> CreateAndEvalAsync(this IRedisConnection connection, string scriptName, string[] keys, string[] argv, string fullScript = "")
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String scriptName

the script's name.

System.String[] keys

the keys to use.

System.String[] argv

the arguments to use.

System.String fullScript

the full script.

Returns
Type Description
System.Threading.Tasks.Task<System.Nullable<System.Int32>>

the result.

Exceptions
Type Condition
System.ArgumentException

Thrown if the script cannot be resolved either the script is empty or the script name has not been encountered.

| Improve this Doc View Source

Get<T>(IRedisConnection, String)

Gets an object of the provided type from redis.

Declaration
public static T Get<T>(this IRedisConnection connection, string keyName)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String keyName

the key.

Returns
Type Description
T

the object out of redis.

Type Parameters
Name Description
T

The type to parse the result out to.

| Improve this Doc View Source

GetAsync<T>(IRedisConnection, String)

Gets an object of the provided type from redis.

Declaration
public static async ValueTask<T> GetAsync<T>(this IRedisConnection connection, string keyName)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String keyName

the key.

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

the object out of redis.

Type Parameters
Name Description
T

The type to parse the result out to.

| Improve this Doc View Source

HGetAll(IRedisConnection, String)

retrieves an object out of redis and puts it into a dictionary.

Declaration
public static IDictionary<string, string> HGetAll(this IRedisConnection connection, string keyName)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String keyName

the key name.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, System.String>

the object serialized into a dictionary.

| Improve this Doc View Source

HGetAllAsync(IRedisConnection, String)

retrieves an object out of redis and puts it into a dictionary.

Declaration
public static async Task<IDictionary<string, string>> HGetAllAsync(this IRedisConnection connection, string keyName)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String keyName

the key name.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String, System.String>>

the object serialized into a dictionary.

| Improve this Doc View Source

HSet(IRedisConnection, String, KeyValuePair<String, String>[])

Set's values in a hash.

Declaration
public static int HSet(this IRedisConnection connection, string key, params KeyValuePair<string, string>[] fieldValues)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key.

System.Collections.Generic.KeyValuePair<System.String, System.String>[] fieldValues

the field value pairs to set.

Returns
Type Description
System.Int32

How many new fields were created.

| Improve this Doc View Source

HSetAsync(IRedisConnection, String, KeyValuePair<String, String>[])

Set's values in a hash.

Declaration
public static async Task<int> HSetAsync(this IRedisConnection connection, string key, params KeyValuePair<string, string>[] fieldValues)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key.

System.Collections.Generic.KeyValuePair<System.String, System.String>[] fieldValues

the field value pairs to set.

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

How many new fields were created.

| Improve this Doc View Source

JsonGet<T>(IRedisConnection, String, String[])

Get's an object out of redis.

Declaration
public static T JsonGet<T>(this IRedisConnection connection, string key, params string[] paths)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key.

System.String[] paths

the paths to retrieve.

Returns
Type Description
T

the object pulled out of redis.

Type Parameters
Name Description
T

the type to deserialize into.

| Improve this Doc View Source

JsonSet(IRedisConnection, String, String, Object)

Sets a value as JSON in redis.

Declaration
public static bool JsonSet(this IRedisConnection connection, string key, string path, object obj)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key for the object.

System.String path

the path within the json to set.

System.Object obj

the object to serialize to json.

Returns
Type Description
System.Boolean

whether the operation succeeded.

| Improve this Doc View Source

JsonSet(IRedisConnection, String, String, String)

Sets a value as JSON in redis.

Declaration
public static bool JsonSet(this IRedisConnection connection, string key, string path, string json)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key for the object.

System.String path

the path within the json to set.

System.String json

the json.

Returns
Type Description
System.Boolean

whether the operation succeeded.

| Improve this Doc View Source

JsonSetAsync(IRedisConnection, String, String, Object)

Sets a value as JSON in redis.

Declaration
public static async Task<bool> JsonSetAsync(this IRedisConnection connection, string key, string path, object obj)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key for the object.

System.String path

the path within the json to set.

System.Object obj

the object to be converted to json.

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

whether the operation succeeded.

| Improve this Doc View Source

JsonSetAsync(IRedisConnection, String, String, String)

Sets a value as JSON in redis.

Declaration
public static async Task<bool> JsonSetAsync(this IRedisConnection connection, string key, string path, string json)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key for the object.

System.String path

the path within the json to set.

System.String json

the json.

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

whether the operation succeeded.

| Improve this Doc View Source

Set(IRedisConnection, Object)

Serializes an object to either hash or json (depending on how it's decorated), and saves it in redis.

Declaration
public static string Set(this IRedisConnection connection, object obj)
Parameters
Type Name Description
IRedisConnection connection

connection to redis.

System.Object obj

the object to save.

Returns
Type Description
System.String

the key for the object.

| Improve this Doc View Source

SetAsync(IRedisConnection, Object)

Serializes an object to either hash or json (depending on how it's decorated), and saves it in redis.

Declaration
public static async Task<string> SetAsync(this IRedisConnection connection, object obj)
Parameters
Type Name Description
IRedisConnection connection

connection to redis.

System.Object obj

the object to save.

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

the key for the object.

| Improve this Doc View Source

Unlink(IRedisConnection, String)

Unlinks a key.

Declaration
public static string Unlink(this IRedisConnection connection, string key)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key to unlink.

Returns
Type Description
System.String

the status.

| Improve this Doc View Source

UnlinkAsync(IRedisConnection, String)

Unlinks a key.

Declaration
public static async Task<string> UnlinkAsync(this IRedisConnection connection, string key)
Parameters
Type Name Description
IRedisConnection connection

the connection.

System.String key

the key to unlink.

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

the status.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX