Class SQLiteCache<T>
This is an implementation of an OfflineStore, using SQLite to manage maintaining data. This class is responsible for breaking apart a request, and determing what actions to take Actual actions are performed on the OfflineTable class, using a SQLiteDatabaseHelper
Inheritance
Implements
Namespace: Kinvey
Assembly: Kinvey.dll
Syntax
public class SQLiteCache<T> : object, ICache<T> where T : class, new()
Type Parameters
Name | Description |
---|---|
T | The type of an item. |
Constructors
| Improve this Doc View SourceSQLiteCache(String, SQLiteAsyncConnection, SQLiteConnection)
Initializes a new instance of the SQLiteCache<T> class.
Declaration
public SQLiteCache(string collection, SQLiteAsyncConnection connectionAsync, SQLiteConnection connectionSync)
Parameters
Type | Name | Description |
---|---|---|
System.String | collection | Collection name. |
SQLite.SQLiteAsyncConnection | connectionAsync | SQLite asynchronous connection. |
SQLite.SQLiteConnection | connectionSync | SQLite synchronous connection. |
Methods
| Improve this Doc View SourceClear(Expression)
Clears this local cache table of all its content.
Declaration
public KinveyDeleteResponse Clear(Expression expr = null)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | [optional] Linq expression. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | The result of delete operation. |
CountAll()
Gets the count of all items.
Declaration
public int CountAll()
Returns
Type | Description |
---|---|
System.Int32 | The count of items. |
CountByQuery(Expression)
Gets the count of items by the expression.
Declaration
public int CountByQuery(Expression expr)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | Expression. |
Returns
Type | Description |
---|---|
System.Int32 | The count of items. |
DeleteByID(String)
Deletes item by id.
Declaration
public KinveyDeleteResponse DeleteByID(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The item identifier. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | The result of delete operation. |
DeleteByIDs(List<String>)
Deletes items by the list of identifiers.
Declaration
public KinveyDeleteResponse DeleteByIDs(List<string> IDs)
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | IDs | The list of identifiers. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | The result of delete operation. |
DeleteByQuery(IQueryable<Object>)
Deletes items according to query.
Declaration
public KinveyDeleteResponse DeleteByQuery(IQueryable<object> query)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<System.Object> | query | Query. |
Returns
Type | Description |
---|---|
KinveyDeleteResponse | The result of delete operation. |
FindAll()
Finds all items.
Declaration
public List<T> FindAll()
Returns
Type | Description |
---|---|
List<T> | The list of items. |
FindByID(String)
Finds the item by id.
Declaration
public T FindByID(string ID)
Parameters
Type | Name | Description |
---|---|---|
System.String | ID | The item identifier. |
Returns
Type | Description |
---|---|
T | The item with the given ID. |
FindByIDs(List<String>)
Finds items by the list of identifiers.
Declaration
public List<T> FindByIDs(List<string> IDs)
Parameters
Type | Name | Description |
---|---|---|
List<System.String> | IDs | The list of identifiers. |
Returns
Type | Description |
---|---|
List<T> | The list of items. |
FindByQuery(Expression)
Finds items by the expression.
Declaration
public List<T> FindByQuery(Expression expr)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | Expression. |
Returns
Type | Description |
---|---|
List<T> | The list of items. |
GetAggregateResult(EnumReduceFunction, String, String, Expression)
Gets group aggregation result.
Declaration
public 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. |
GetAsync(String)
Declaration
public Task<List<T>> GetAsync(string query)
Parameters
Type | Name | Description |
---|---|---|
System.String | query |
Returns
Type | Description |
---|---|
Task<List<T>> |
IsCacheEmpty()
Determines if cache is empty or not.
Declaration
public bool IsCacheEmpty()
Returns
Type | Description |
---|---|
System.Boolean |
|
RefreshCache(List<T>)
Refreshes items.
Declaration
public List<T> RefreshCache(List<T> items)
Parameters
Type | Name | Description |
---|---|---|
List<T> | items | The list of items to refresh. |
Returns
Type | Description |
---|---|
List<T> | The list of refreshed items. |
Save(T)
Saves the specified item.
Declaration
public 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>)
Saves the specified items.
Declaration
public List<T> Save(List<T> items)
Parameters
Type | Name | Description |
---|---|---|
List<T> | items | The items to save in the cache. |
Returns
Type | Description |
---|---|
List<T> | The saved items. |
Update(T)
Updates the specified item.
Declaration
public T Update(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to update in the cache. |
Returns
Type | Description |
---|---|
T | The updated item. |
UpdateCacheSave(T, String)
Updates the identifier in the specified item.
Declaration
public T UpdateCacheSave(T item, string tempID)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to update in the cache. |
System.String | tempID | The temporary ID used in the cache, which will be replaced with the permanent ID. |
Returns
Type | Description |
---|---|
T | The updated item. |