Я использую кэш лазурного редиса после учебника https://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-service/. Как я могу использовать этот кеш без с помощью webconfig? Вот мой код.Azure Управляемый кеш без webconfig
C# код
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ApplicationServer.Caching;
using System.Data;
using System.Data.SqlClient;
namespace MoviesDB.CacheWrappers
{
public class AzureManagedCache
{
DataCache AzureCache = new DataCache("default");
public void Add(string sqlQuery, DataTable records)
{
List<Movie> movies = new List<Movie>();
movies = MovieDBContext.ConvertToMovies(records);
AzureCache.Add("sqlQuery", movies);
}
public void Delete(string sqlQuery)
{
AzureCache.Remove("sqlQuery");
}
public object Read(string sqlQuery)
{
var movie = AzureCache.Get("sqlQuery");
return movie;
}
}
}
и webconfig.xml
<dataCacheClients>
<dataCacheClient name="default">
<!--To use the in-role flavor of Windows Azure Cache, set identifier to be the cache cluster role name
To use the Windows Azure Cache Service, set identifier to be the endpoint of the cache cluster-->
<autoDiscover isEnabled="true" identifier="******.cache.windows.net" />
<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />
<!--Use this section to specify security settings for connecting to your cache. This section is not required if your cache is hosted on a role that is a part of your cloud service.-->
<securityProperties mode="Message" sslEnabled="true">
<messageSecurity authorizationInfo="******" />
</securityProperties>
</dataCacheClient>
</dataCacheClients>
спасибо ... это работает !!!! – Celia