Interface ICache<T>
Interface for the data store cache.
Namespace: Kinvey
Assembly: Kinvey.dll
Syntax
public interface ICache<T>
Type Parameters
Name | Description |
---|---|
T | The type of an item. |
Methods
| Improve this Doc View SourceClear(Expression)
Deletes all the cached items.
Declaration
KinveyDeleteResponse Clear(Expression expr = null)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | [optional] Expression derived from QueryModel object. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | A KinveyDeleteResponse object. |
CountAll()
Counts of all items in the cache.
Declaration
int CountAll()
Returns
Type | Description |
---|---|
System.Int32 | A count of all cache items. |
CountByQuery(Expression)
Counts entities by query.
Declaration
int CountByQuery(Expression expr)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | Expression derived from QueryModel object. |
Returns
Type | Description |
---|---|
System.Int32 | Count of entities matching the given query |
DeleteByID(String)
Deletes the cached item by ID.
Declaration
KinveyDeleteResponse DeleteByID(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the entity to delete from the cache. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | A KinveyDeleteResponse object. |
DeleteByIDs(List<String>)
Deletes a list of entities by the given IDs.
Declaration
KinveyDeleteResponse DeleteByIDs(List<string> IDs)
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | IDs | The IDs of the entities to delete from the cache. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | A KinveyDeleteResponse object. |
DeleteByQuery(IQueryable<Object>)
Deletes a list of entities by the query.
Declaration
KinveyDeleteResponse DeleteByQuery(IQueryable<object> query)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<System.Object> | query | Query to delete entities from the cache. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | KinveyDeleteResponse object. |
FindAll()
Finds all items in the cache.
Declaration
List<T> FindAll()
Returns
Type | Description |
---|---|
List<T> | All cache items. |
FindByID(String)
Finds the by entity ID.
Declaration
T FindByID(string ID)
Parameters
Type | Name | Description |
---|---|---|
System.String | ID | The ID of the entity to find. |
Returns
Type | Description |
---|---|
T | The entity with the given ID. |
FindByIDs(List<String>)
Finds a list of entities by the given IDs.
Declaration
List<T> FindByIDs(List<string> ids)
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | ids | The IDs to find. |
Returns
Type | Description |
---|---|
List<T> | A list of the entities matching the given IDs. |
FindByQuery(Expression)
Finds entities by query.
Declaration
List<T> FindByQuery(Expression expr)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | Expression derived from QueryModel object. |
Returns
Type | Description |
---|---|
List<T> | List of entities matching the given query |
GetAggregateResult(EnumReduceFunction, String, String, Expression)
Gets group aggregation result.
Declaration
List<GroupAggregationResults> GetAggregateResult(EnumReduceFunction reduceFunction, string groupField, string aggregateField, Expression query)
Parameters
Type | Name | Description |
---|---|---|
EnumReduceFunction | reduceFunction | Reduce function. |
System.String | groupField | Group field. |
System.String | aggregateField | Aggregate field. |
Expression | query | Linq expression. |
Returns
Type | Description |
---|---|
List<GroupAggregationResults> | The list of group aggregation results. |
IsCacheEmpty()
Checks if the cache is empty.
Declaration
bool IsCacheEmpty()
Returns
Type | Description |
---|---|
System.Boolean |
|
RefreshCache(List<T>)
Refreshs the cache with the latest items from the backend.
Declaration
List<T> RefreshCache(List<T> items)
Parameters
Type | Name | Description |
---|---|---|
List<T> | items | List of items used to refresh cache. |
Returns
Type | Description |
---|---|
List<T> | The list of cached items. |
Save(T)
Save the specified item.
Declaration
T Save(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to save in the cache. |
Returns
Type | Description |
---|---|
T | The saved item. |
Save(List<T>)
Save the specified list of item.
Declaration
List<T> Save(List<T> items)
Parameters
Type | Name | Description |
---|---|---|
List<T> | items | The list of items to save in the cache. |
Returns
Type | Description |
---|---|
List<T> | The list of saved items. |
Update(T)
Update the specified item.
Declaration
T Update(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | Item. |
Returns
Type | Description |
---|---|
T | The updated item. |
UpdateCacheSave(T, String)
Updates the cached item with the final ID.
Declaration
T UpdateCacheSave(T item, string tempID)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to update. |
System.String | tempID | The temporary ID used in the cached, which will be replaced with the permanent ID. |
Returns
Type | Description |
---|---|
T | The cached item. |