Class ServiceCache
The cache that restores the data directly from the service. In this case there is no storage of data, as the service acts as the master.
Implements
Namespace: Microsoft.Graph.Communications.Client.Cache
Assembly: Microsoft.Graph.Communications.Client.dll
Syntax
public class ServiceCache : ObjectRootDisposable, ICache
Constructors
ServiceCache(IGraphLogger, IGraphClient, ISerializer, String)
Initializes a new instance of the ServiceCache class.
Declaration
public ServiceCache(IGraphLogger logger, IGraphClient client, ISerializer serializer, string baseUri)
Parameters
Type | Name | Description |
---|---|---|
IGraphLogger | logger | Logger instance. |
IGraphClient | client | The client. |
ISerializer | serializer | The serializer. |
String | baseUri | The base URI. |
Methods
GetDataAsync<T>(IEnumerable<IGraphProperty>, String, CancellationToken)
Gets the serialized string of the data at the specified resource path asynchronously. Fetching data only happens in HA/DR scenarios, so could take longer.
Declaration
public Task<string> GetDataAsync<T>(IEnumerable<IGraphProperty> properties, string resourcePath, CancellationToken cancellationToken = default(CancellationToken))
where T : Entity
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IGraphProperty> | properties | The properties. |
String | resourcePath | The resource path. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<String> | The recovered serialized data at the specified resource path. |
Type Parameters
Name | Description |
---|---|
T | The type of Entity to fetch. |
GetDataCollectionAsync<T>(IEnumerable<IGraphProperty>, String, CancellationToken)
Gets the resource paths for the children of the collection with the specified resource path asynchronously. Fetching data only happens in HA/DR scenarios, so could take longer.
Declaration
public Task<IEnumerable<string>> GetDataCollectionAsync<T>(IEnumerable<IGraphProperty> properties, string resourcePath, CancellationToken cancellationToken = default(CancellationToken))
where T : Entity
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IGraphProperty> | properties | The properties. |
String | resourcePath | The resource path. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IEnumerable<String>> | The recovered collection or child resource paths. |
Type Parameters
Name | Description |
---|---|
T | The type of Entity contained in the collection. |
SetData(ChangeType, IResource, IEnumerable<IGraphProperty>, String, Lazy<String>)
Sets the data under the specified resource path. These should be short running operations, as they block notification callbacks.
Declaration
public void SetData(ChangeType change, IResource resource, IEnumerable<IGraphProperty> properties, string resourcePath, Lazy<string> serializedData)
Parameters
Type | Name | Description |
---|---|---|
ChangeType | change | The type of change occuring. |
IResource | resource | The resource being serialized. |
IEnumerable<IGraphProperty> | properties | The properties. |
String | resourcePath | The resource path. |
Lazy<String> | serializedData | The serialized data lazy string. For performance reasons the string is only serialized when requested. |