Show / Hide Table of Contents

# Class CacheLinqExtensions

Extensions methods for ICache<TK, TV>.

##### Inheritance

System.Object
CacheLinqExtensions

##### Inherited Members

System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Apache.Ignite.Linq

###### Assembly: Apache.Ignite.Linq.dll

##### Syntax

    public static class CacheLinqExtensions

### Methods

#### AsCacheQueryable<TKey, TValue>(ICache<TKey, TValue>)

Gets an System.Linq.IQueryable<T> instance over this cache.

Resulting query will be translated to cache SQL query and executed over the cache instance via Query(SqlFieldsQuery).

Result of this method (and subsequent query) can be cast to ICacheQueryable for introspection, or converted with ToCacheQueryable<T>(IQueryable<T>) extension method.

##### Declaration

    public static IQueryable<ICacheEntry<TKey, TValue>> AsCacheQueryable<TKey, TValue>(this ICache<TKey, TValue> cache)

##### Parameters

Type | Name | Description
--- | --- | ---
ICache<TKey, TValue> | cache | The cache.

##### Returns

Type | Description
--- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | System.Linq.IQueryable<T> instance over this cache.

##### Type Parameters

Name | Description
--- | ---
TKey | The type of the key.
TValue | The type of the value.

#### AsCacheQueryable<TKey, TValue>(ICache<TKey, TValue>, QueryOptions)

Gets an System.Linq.IQueryable<T> instance over this cache.

Resulting query will be translated to cache SQL query and executed over the cache instance via Query(SqlFieldsQuery). depending on requested result.

Result of this method (and subsequent query) can be cast to ICacheQueryable for introspection.

##### Declaration

    public static IQueryable<ICacheEntry<TKey, TValue>> AsCacheQueryable<TKey, TValue>(this ICache<TKey, TValue> cache, QueryOptions queryOptions)

##### Parameters

Type | Name | Description
--- | --- | ---
ICache<TKey, TValue> | cache | The cache.
QueryOptions | queryOptions | The query options.

##### Returns

Type | Description
--- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | System.Linq.IQueryable<T> instance over this cache.

##### Type Parameters

Name | Description
--- | ---
TKey | The type of the key.
TValue | The type of the value.

#### AsCacheQueryable<TKey, TValue>(ICache<TKey, TValue>, Boolean)

Gets an System.Linq.IQueryable<T> instance over this cache.

Resulting query will be translated to cache SQL query and executed over the cache instance via Query(SqlFieldsQuery). depending on requested result.

Result of this method (and subsequent query) can be cast to ICacheQueryable for introspection.

##### Declaration

    public static IQueryable<ICacheEntry<TKey, TValue>> AsCacheQueryable<TKey, TValue>(this ICache<TKey, TValue> cache, bool local)

##### Parameters

Type | Name | Description
--- | --- | ---
ICache<TKey, TValue> | cache | The cache.
System.Boolean | local | Local flag. When set query will be executed only on local node, so only local entries will be returned as query result.

##### Returns

Type | Description
--- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | System.Linq.IQueryable<T> instance over this cache.

##### Type Parameters

Name | Description
--- | ---
TKey | The type of the key.
TValue | The type of the value.

#### AsCacheQueryable<TKey, TValue>(ICache<TKey, TValue>, Boolean, String)

Gets an System.Linq.IQueryable<T> instance over this cache.

Resulting query will be translated to cache SQL query and executed over the cache instance via Query(SqlFieldsQuery). depending on requested result.

Result of this method (and subsequent query) can be cast to ICacheQueryable for introspection.

##### Declaration

    public static IQueryable<ICacheEntry<TKey, TValue>> AsCacheQueryable<TKey, TValue>(this ICache<TKey, TValue> cache, bool local, string tableName)

##### Parameters

Type | Name | Description
--- | --- | ---
ICache<TKey, TValue> | cache | The cache.
System.Boolean | local | Local flag. When set query will be executed only on local node, so only local entries will be returned as query result.
System.String | tableName | Name of the table. Table name is equal to short class name of a cache value. When a cache has only one type of values, or only one QueryEntity defined, table name will be inferred and can be omitted.

##### Returns

Type | Description
--- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | System.Linq.IQueryable<T> instance over this cache.

##### Type Parameters

Name | Description
--- | ---
TKey | The type of the key.
TValue | The type of the value.

#### RemoveAll<TKey, TValue>(IQueryable<ICacheEntry<TKey, TValue>>)

Removes all rows that are matched by the specified query.

This method results in "DELETE FROM" distributed SQL query, performing bulk delete (as opposed to fetching all rows locally).

##### Declaration

    public static int RemoveAll<TKey, TValue>(this IQueryable<ICacheEntry<TKey, TValue>> query)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | query | The query.

##### Returns

Type | Description
--- | ---
System.Int32 | Affected row count.

##### Type Parameters

Name | Description
--- | ---
TKey | Key type.
TValue | Value type.

#### RemoveAll<TKey, TValue>(IQueryable<ICacheEntry<TKey, TValue>>, Expression<Func<ICacheEntry<TKey, TValue>, Boolean>>)

Deletes all rows that are matched by the specified query.

This method results in "DELETE FROM" distributed SQL query, performing bulk delete (as opposed to fetching all rows locally).

##### Declaration

    public static int RemoveAll<TKey, TValue>(this IQueryable<ICacheEntry<TKey, TValue>> query, Expression<Func<ICacheEntry<TKey, TValue>, bool>> predicate)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | query | The query.
System.Linq.Expressions.Expression<System.Func<ICacheEntry<TKey, TValue>, System.Boolean>> | predicate | The predicate.

##### Returns

Type | Description
--- | ---
System.Int32 | Affected row count.

##### Type Parameters

Name | Description
--- | ---
TKey | Key type.
TValue | Value type.

#### ToCacheQueryable<T>(IQueryable<T>)

Casts this query to ICacheQueryable.

##### Declaration

    public static ICacheQueryable ToCacheQueryable<T>(this IQueryable<T> query)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Linq.IQueryable<T> | query |

##### Returns

Type | Description
--- | ---
ICacheQueryable |

##### Type Parameters

Name | Description
--- | ---
T |

#### UpdateAll<TKey, TValue>(IQueryable<ICacheEntry<TKey, TValue>>, Expression<Func<IUpdateDescriptor<TKey, TValue>, IUpdateDescriptor<TKey, TValue>>>)

Updates all rows that are matched by the specified query.

This method results in "UPDATE" distributed SQL query, performing bulk update (as opposed to fetching all rows locally).

##### Declaration

    public static int UpdateAll<TKey, TValue>(this IQueryable<ICacheEntry<TKey, TValue>> query, Expression<Func<IUpdateDescriptor<TKey, TValue>, IUpdateDescriptor<TKey, TValue>>> updateDescription)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Linq.IQueryable<ICacheEntry<TKey, TValue>> | query | The query.
System.Linq.Expressions.Expression<System.Func<IUpdateDescriptor<TKey, TValue>, IUpdateDescriptor<TKey, TValue>>> | updateDescription | The update description.

##### Returns

Type | Description
--- | ---
System.Int32 | Affected row count.

##### Type Parameters

Name | Description
--- | ---
TKey | Key type.
TValue | Value type.