├── .gitattributes ├── .gitignore ├── .vs └── config │ └── applicationhost.config ├── CustomMonitoring ├── App.config ├── CustomMonitoring.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md └── packages.config ├── HelloWorld ├── App.config ├── Clustering.cs ├── ConnectionOptions.cs ├── GeneralConcepts.cs ├── GettingStarted.cs ├── HelloWorld.csproj ├── Helper.cs ├── KeySpaceNotifications.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── RedisLists.cs ├── RedisSortedSets.cs ├── RedisString.cs ├── RedisTags.cs └── packages.config ├── ManageCacheUsingMAML ├── App.config ├── ManageCacheUsingMAML.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md └── packages.config ├── README.md ├── RedisAsSignalRBackplane ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── RegisterHubs.cs │ └── RouteConfig.cs ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css ├── Controllers │ └── HomeController.cs ├── FireworkHub.cs ├── Global.asax ├── Global.asax.cs ├── Images │ ├── c_0.png │ ├── c_0_h.png │ ├── c_1.png │ ├── c_1_h.png │ ├── c_2.png │ ├── c_2_h.png │ ├── c_3.png │ ├── c_3_h.png │ ├── c_4.png │ ├── c_4_h.png │ ├── c_5.png │ ├── c_5_h.png │ ├── c_6.png │ ├── c_6_h.png │ ├── r_0.png │ ├── r_0_h.png │ ├── r_1.png │ ├── r_1_h.png │ ├── r_2.png │ ├── r_2_h.png │ ├── t_0.png │ ├── t_0_h.png │ ├── t_1.png │ └── t_1_h.png ├── Project_Readme.html ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── RedisAsSignalRBackplane.csproj ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.signalR-2.2.0.js │ ├── jquery.signalR-2.2.0.min.js │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── knockout-3.1.0.debug.js │ ├── knockout-3.1.0.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js ├── Startup.cs ├── Views │ ├── Home │ │ └── Index.cshtml │ └── Web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── nightcity.png └── packages.config ├── RedisCacheCustomerQuerySample ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ └── WebApiConfig.cs ├── Content │ ├── Site.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ └── themes │ │ └── base │ │ ├── accordion.css │ │ ├── all.css │ │ ├── autocomplete.css │ │ ├── base.css │ │ ├── button.css │ │ ├── core.css │ │ ├── datepicker.css │ │ ├── dialog.css │ │ ├── draggable.css │ │ ├── images │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ │ ├── menu.css │ │ ├── progressbar.css │ │ ├── resizable.css │ │ ├── selectable.css │ │ ├── selectmenu.css │ │ ├── slider.css │ │ ├── sortable.css │ │ ├── spinner.css │ │ ├── tabs.css │ │ ├── theme.css │ │ └── tooltip.css ├── Controllers │ ├── AutoCompleteController.cs │ ├── HomeController.cs │ └── ProductAutoCompleteController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ └── HomeViewModel.cs ├── Project_Readme.html ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── RedisCacheCustomerQuerySample.csproj ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery-ui-1.11.3.js │ ├── jquery-ui-1.11.3.min.js │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js ├── Views │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ ├── Index.cshtml │ │ └── Products.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff └── packages.config ├── RedisSamples.sln ├── SeedCacheForCustomerQuerySample ├── App.config ├── CSV_Database_of_Categories.csv ├── CSV_Database_of_First_Names.csv ├── CSV_Database_of_Last_Names.csv ├── CSV_Database_of_Products.csv ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── SeedCacheForCustomerQuerySample.csproj └── packages.config └── SessionState_OutputCaching ├── Default.aspx ├── Default.aspx.cs ├── Default.aspx.designer.cs ├── Properties └── AssemblyInfo.cs ├── README.md ├── SessionState_OutputCaching.csproj ├── Web.Debug.config ├── Web.Release.config ├── Web.config └── packages.config /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Make sh files under the build directory always have LF as line endings 8 | ############################################################################### 9 | build/*.sh eol=lf 10 | 11 | 12 | ############################################################################### 13 | # Set default behavior for command prompt diff. 14 | # 15 | # This is need for earlier builds of msysgit that does not have it on by 16 | # default for csharp files. 17 | # Note: This is only used by command line 18 | ############################################################################### 19 | #*.cs diff=csharp 20 | 21 | ############################################################################### 22 | # Set the merge driver for project and solution files 23 | # 24 | # Merging from the command prompt will add diff markers to the files if there 25 | # are conflicts (Merging from VS is not affected by the settings below, in VS 26 | # the diff markers are never inserted). Diff markers may cause the following 27 | # file extensions to fail to load in VS. An alternative would be to treat 28 | # these files as binary and thus will always conflict and require user 29 | # intervention with every merge. To do so, just uncomment the entries below 30 | ############################################################################### 31 | #*.sln merge=binary 32 | #*.csproj merge=binary 33 | #*.vbproj merge=binary 34 | #*.vcxproj merge=binary 35 | #*.vcproj merge=binary 36 | #*.dbproj merge=binary 37 | #*.fsproj merge=binary 38 | #*.lsproj merge=binary 39 | #*.wixproj merge=binary 40 | #*.modelproj merge=binary 41 | #*.sqlproj merge=binary 42 | #*.wwaproj merge=binary 43 | 44 | ############################################################################### 45 | # behavior for image files 46 | # 47 | # image files are treated as binary by default. 48 | ############################################################################### 49 | #*.jpg binary 50 | #*.png binary 51 | #*.gif binary 52 | 53 | ############################################################################### 54 | # diff behavior for common document formats 55 | # 56 | # Convert binary document formats to text before diffing them. This feature 57 | # is only available from the command line. Turn it on by uncommenting the 58 | # entries below. 59 | ############################################################################### 60 | #*.doc diff=astextplain 61 | #*.DOC diff=astextplain 62 | #*.docx diff=astextplain 63 | #*.DOCX diff=astextplain 64 | #*.dot diff=astextplain 65 | #*.DOT diff=astextplain 66 | #*.pdf diff=astextplain 67 | #*.PDF diff=astextplain 68 | #*.rtf diff=astextplain 69 | #*.RTF diff=astextplain 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.user 5 | _ReSharper.* 6 | *.DS_Store 7 | *.userprefs 8 | *.pidb 9 | *.vspx 10 | *.psess 11 | packages 12 | target 13 | artifacts 14 | StyleCop.Cache 15 | node_modules 16 | *.snk 17 | .nuget/NuGet.exe 18 | -------------------------------------------------------------------------------- /CustomMonitoring/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /CustomMonitoring/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Azure; 2 | using Microsoft.Azure.Common.OData; 3 | using Microsoft.Azure.Insights; 4 | using Microsoft.Azure.Insights.Models; 5 | using Microsoft.IdentityModel.Clients.ActiveDirectory; 6 | using StackExchange.Redis; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace CustomMonitoring 15 | { 16 | class Program 17 | { 18 | public static string subscriptionId = ""; // Get this from the Azure Portal 19 | public static string resourceGroupName = ""; //,Get this from the Azure Portal 20 | public static string cacheName = ""; // This is just the name (without redis.cache.windows.net) 21 | 22 | // Use the following link to learn how to setup this app to access Active Directory 23 | // https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx#bk_portal 24 | public static string tenantId = ""; 25 | public static string clientId = ""; 26 | public static string redirectUri = ""; // Your app name 27 | 28 | static void Main(string[] args) 29 | { 30 | // Define the base URI for management operations 31 | var azureUrl = "https://management.azure.com"; // or "https://management.chinacloudapi.cn/" for China 32 | Uri baseUri = new Uri(azureUrl); 33 | 34 | string token = GetAuthorizationHeader(); 35 | var startTime = DateTime.Now; 36 | var endTime = startTime.ToUniversalTime().AddHours(1.0).ToLocalTime(); 37 | var redisConnection = ""; 38 | 39 | 40 | // Get the credentials 41 | // You can find instructions on how to get the token here: 42 | // http://msdn.microsoft.com/en-us/library/azure/dn790557.aspx 43 | SubscriptionCloudCredentials credentials = new TokenCloudCredentials(subscriptionId, token); 44 | 45 | // Create an instance of the InsightsClient from Microsoft.Azure.Insights 46 | InsightsClient client = new InsightsClient(credentials, baseUri); 47 | 48 | // Get the events for an Azure Resource (e.g. Website) (as described by the Azure Resource Manager APIs here:http://msdn.microsoft.com/en-us/library/azure/dn790569.aspx) 49 | // A resource URI looks like the following string: 50 | //"/subscriptions/########-####-####-####-############/resourceGroups/resourcegroupname1/providers/resourceprovider1/resourcename1" 51 | string resourceUri = string.Format("subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Cache/redis/{2}", subscriptionId, resourceGroupName, cacheName); 52 | 53 | //Define a FilterString 54 | string filterString = FilterString.Generate(eventData => (eventData.EventTimestamp >= startTime) && (eventData.EventTimestamp <= endTime) && (eventData.ResourceId == resourceUri)); 55 | 56 | //Get the events logs 57 | EventDataListResponse response = client.EventOperations.ListEvents(filterString, selectedProperties: null); 58 | 59 | 60 | //Check the status code of the response 61 | Console.WriteLine("HTTP Status Code returned for the call:" + response.StatusCode); 62 | 63 | var response2 = client.MetricDefinitionOperations.GetMetricDefinitions(resourceUri, ""); 64 | var metrics = client.MetricOperations.GetMetrics(resourceUri, "startTime eq " + startTime.ToString("yyyy-MM-ddThh:mm:ss") + "and endTime eq " + endTime.ToString("yyyy-MM-ddThh:mm:ss") + " and timeGrain eq duration'PT5M'", response2.MetricDefinitionCollection.Value); 65 | Console.WriteLine("Print out the metrics logs"); 66 | foreach (var item in metrics.MetricCollection.Value) 67 | { 68 | Console.WriteLine(item.Name.Value + "--" + item.MetricValues.Count); 69 | } 70 | 71 | } 72 | private static string GetAuthorizationHeader() 73 | { 74 | AuthenticationResult result = null; 75 | 76 | var url1 = "https://login.windows.net/"; // or "https://login.chinacloudapi.cn" for China 77 | var url2 = "https://management.core.windows.net/"; // or "https://management.core.chinacloudapi.cn/" for China 78 | var context = new AuthenticationContext(new Uri(new Uri(url1), tenantId).AbsoluteUri); 79 | var thread = new Thread(() => 80 | { 81 | 82 | result = context.AcquireToken( 83 | url2, 84 | "1950a258-227b-4e31-a9cf-717495945fc2", // clientId 85 | new Uri("urn:ietf:wg:oauth:2.0:oob")); 86 | }); 87 | 88 | thread.SetApartmentState(ApartmentState.STA); 89 | thread.Name = "AquireTokenThread"; 90 | thread.Start(); 91 | thread.Join(); 92 | 93 | if (result == null) 94 | { 95 | throw new InvalidOperationException("Failed to obtain the JWT token"); 96 | } 97 | 98 | string token = result.AccessToken; 99 | return token; 100 | } 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /CustomMonitoring/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CustomMonitoring")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CustomMonitoring")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("45d08c55-459d-433a-928f-02cb5f4bcd59")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CustomMonitoring/README.md: -------------------------------------------------------------------------------- 1 | Access Redis Cache Monitoring data 2 | ==================================== 3 | 4 | This sample demonstrates how you can access monitoring data for your Azure Redis Cache outside of the Azure portal. 5 | Azure Redis Cache has a new monitoring system gives you the capability to store monitoring and diagnostics data for your cache in your own Azure Storage account, which means that you can now use the tools of your choice to access this data. To ensure you continue to receive monitoring and diagnostics data for your cache and alert rules, we recommend that you configure an Azure Storage account where all the monitoring and diagnostics data will be stored. 6 | 7 | ## Prereq 8 | This sample uses the Microsoft Azure Insights SDK which is used to access the monitoring data outside the portal. The SDK right now is in preview 9 | Please take a look at the SDK here: https://www.nuget.org/packages/Microsoft.Azure.Insights/ 10 | The documentation is here: http://msdn.microsoft.com/en-us/library/azure/dn802153.aspx 11 | 12 | ## How To Run This Sample 13 | 14 | You need the following information from Azure Portal 15 | - Setup your app for Authenticating Azure Resource Manager with Active Directory. For How-To instructions please read https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx#bk_portal 16 | - Your SubscriptionId 17 | - ResourceGroupName where the Redis is CacheA 18 | - Cache Name. This is just the name (without redis.cache.windows.net) 19 | 20 | -------------------------------------------------------------------------------- /CustomMonitoring/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /HelloWorld/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /HelloWorld/Clustering.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | 11 | namespace HelloWorld 12 | { 13 | /// 14 | /// Connect to individual shard shard: https://azure.microsoft.com/en-us/documentation/articles/cache-how-to-premium-clustering/ 15 | /// redis-cli.exe -h cachename.redis.cache.windows.net -a password -p 13000 16 | /// 17 | public static class Clustering 18 | { 19 | // All keys will be distributed across the shards in the cluster. 20 | public static string clusterKey = "democluster"; 21 | 22 | // All customers will be on the same shard. 23 | public static string clusterAllCustomersKey = "{demoallcustomer}id"; 24 | 25 | // Customers and Order details of the customer will be on the same shard. 26 | public static string clusterCustomersWithOrders = "{democustomer:id}"; 27 | public static string clusterCustomerOrderKey = "{democustomer:id}.orders"; 28 | 29 | public static string keyValue = DateTime.Now.ToString(); 30 | public static void Run() 31 | { 32 | IDatabase cache = Helper.Connection.GetDatabase(); 33 | DemoSetup(cache); 34 | for (int i = 0; i < 10; i++) 35 | { 36 | cache.StringSet(clusterKey + i.ToString(), keyValue+clusterKey + i.ToString()); 37 | cache.StringSet(clusterAllCustomersKey.Replace("id",i.ToString()), keyValue + clusterAllCustomersKey.Replace("id", i.ToString())); 38 | } 39 | for (int i = 10; i < 20; i++) 40 | { 41 | cache.StringSet(clusterCustomersWithOrders.Replace("id", i.ToString()), keyValue + clusterCustomersWithOrders.Replace("id", i.ToString())); 42 | cache.StringSet(clusterCustomerOrderKey.Replace("id", i.ToString()), keyValue + clusterCustomerOrderKey.Replace("id", i.ToString())); 43 | } 44 | 45 | for (int i = 0; i < 10; i++) 46 | { 47 | Console.WriteLine(clusterKey+i+"="+cache.StringGet(clusterKey + i.ToString())); 48 | Console.WriteLine(clusterAllCustomersKey.Replace("id", i.ToString()) +"=" + cache.StringGet(clusterAllCustomersKey.Replace("id", i.ToString()))); 49 | Console.WriteLine(clusterCustomerOrderKey.Replace("id", i.ToString()) + "=" + cache.StringGet(clusterCustomerOrderKey.Replace("id", i.ToString()))); 50 | } 51 | for (int i = 10; i < 20; i++) 52 | { 53 | Console.WriteLine(clusterCustomersWithOrders.Replace("id", i.ToString()) + "=" + cache.StringGet(clusterCustomersWithOrders.Replace("id", i.ToString()))); 54 | Console.WriteLine(clusterCustomerOrderKey.Replace("id", i.ToString()) + "=" + cache.StringGet(clusterCustomerOrderKey.Replace("id", i.ToString()))); 55 | } 56 | } 57 | 58 | private static void DemoSetup(IDatabase cache) 59 | { 60 | for (int i = 0; i < 20; i++) 61 | { 62 | cache.KeyDelete(clusterKey + i.ToString()); 63 | cache.KeyDelete(clusterAllCustomersKey.Replace("id", i.ToString())); 64 | cache.KeyDelete(clusterCustomerOrderKey.Replace("id", i.ToString())); 65 | cache.KeyDelete(clusterCustomersWithOrders.Replace("id", i.ToString())); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /HelloWorld/ConnectionOptions.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Configuration; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HelloWorld 10 | { 11 | // Single Instance for app. - Reuse ConnectionMultiplexer 12 | // Timeout options 13 | // Key Expiration options 14 | // How should the multiplexer be configured. 15 | public static class ConnectionOptions 16 | { 17 | public static void Run() 18 | { 19 | 20 | IDatabase cache = Connection.GetDatabase(); 21 | 22 | // Demo Setup 23 | DemoSetup(cache); 24 | //String 25 | cache.StringSet("i", 1); 26 | Console.WriteLine("Current Value=" + cache.StringGet("i")); 27 | 28 | } 29 | 30 | private static void DemoSetup(IDatabase cache) 31 | { 32 | cache.KeyDelete("i"); 33 | } 34 | 35 | private static Lazy lazyConnection = new Lazy(() => 36 | { 37 | ConfigurationOptions config = new ConfigurationOptions(); 38 | config.EndPoints.Add(ConfigurationManager.AppSettings["RedisCacheName"]); 39 | config.Password = ConfigurationManager.AppSettings["RedisCachePassword"]; 40 | config.Ssl = true; 41 | config.AbortOnConnectFail = false; 42 | config.ConnectRetry = 5; 43 | config.ConnectTimeout = 1000; 44 | return ConnectionMultiplexer.Connect(config); 45 | }); 46 | 47 | public static ConnectionMultiplexer Connection 48 | { 49 | get 50 | { 51 | return lazyConnection.Value; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /HelloWorld/GeneralConcepts.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HelloWorld 9 | { 10 | public static class GeneralConcepts 11 | { 12 | public static void Run() 13 | { 14 | IDatabase cache = Helper.Connection.GetDatabase(); 15 | 16 | // Demo Setup 17 | DemoSetup(cache); 18 | 19 | //String SET 20 | cache.StringSet("i1", 1); 21 | cache.StringSet("i2", 2); 22 | 23 | // Pipeling 24 | #region Pipelining 25 | var task1 = cache.StringGetAsync("i1"); 26 | var task2 = cache.StringGetAsync("i2"); 27 | 28 | var customer1 = cache.Wait(task1); 29 | var customer2 = cache.Wait(task2); 30 | #endregion 31 | 32 | #region Atomic 33 | Console.WriteLine("######Atomic######"); 34 | 35 | cache.StringSet("i3", 99); 36 | Console.WriteLine("old=" + 99); 37 | 38 | long oldValue = cache.StringIncrement("i3"); 39 | Console.WriteLine("new=" + oldValue); 40 | 41 | string resultGetSet = cache.StringGetSet("i3", 0); 42 | Console.WriteLine("GETSET=" + resultGetSet); 43 | Console.WriteLine("GETSET=" + cache.StringGet("i3")); 44 | 45 | #endregion 46 | 47 | 48 | #region MGET/MSET 49 | Console.WriteLine("######MGET/MSET######"); 50 | var keysAndValues = 51 | new List>() 52 | { 53 | new KeyValuePair("i:1", "value1"), 54 | new KeyValuePair("i:2", "value2"), 55 | new KeyValuePair("i:3", "value3") 56 | }; 57 | 58 | // Store the list of key/value pairs in the cache 59 | cache.StringSet(keysAndValues.ToArray()); 60 | 61 | // Find all values that match a list of keys 62 | RedisKey[] keys = { "i:1", "i:2", "i:3" }; 63 | RedisValue[] values = null; 64 | values = cache.StringGet(keys); 65 | 66 | foreach (var item in values) 67 | { 68 | Console.WriteLine(item); 69 | } 70 | #endregion 71 | 72 | #region Transaction 73 | Console.WriteLine("######Transaction######"); 74 | ITransaction transaction = cache.CreateTransaction(); 75 | 76 | var tx1 = transaction.StringIncrementAsync("i:t1"); 77 | var tx2 = transaction.StringDecrementAsync("i:t2"); 78 | bool result = transaction.Execute(); 79 | 80 | Console.WriteLine("Transaction {0}", result ? "succeeded" : "failed"); 81 | Console.WriteLine("Result of increment: {0}", tx1.Result); 82 | Console.WriteLine("Result of decrement: {0}", tx2.Result); 83 | #endregion 84 | 85 | 86 | } 87 | 88 | private static void DemoSetup(IDatabase cache) 89 | { 90 | cache.KeyDelete("i1"); 91 | cache.KeyDelete("i2"); 92 | cache.KeyDelete("i3"); 93 | cache.KeyDelete("i:1"); 94 | cache.KeyDelete("i:2"); 95 | cache.KeyDelete("i:3"); 96 | cache.KeyDelete("i:t1"); 97 | cache.KeyDelete("i:t2"); 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /HelloWorld/GettingStarted.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using StackExchange.Redis; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Configuration; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace HelloWorld 11 | { 12 | public static class GettingStarted 13 | { 14 | public static void Run() 15 | { 16 | IDatabase cache = Connection.GetDatabase(); 17 | 18 | // Demo Setup 19 | DemoSetup(cache); 20 | 21 | // App Usage 22 | var itemKey = "itemkey"; 23 | 24 | string itemValue = cache.StringGet(itemKey); 25 | if(itemValue == null) 26 | { 27 | // Get From Persistent storage and store in Cache. 28 | itemValue = GetFromPersistentStorage(itemKey); 29 | cache.StringSet(itemKey, itemValue); 30 | } 31 | 32 | Console.WriteLine("Value retrieved =" + cache.StringGet(itemKey)); 33 | 34 | } 35 | 36 | private static Lazy lazyConnection = new Lazy(() => 37 | { 38 | return ConnectionMultiplexer.Connect(ConfigurationManager.AppSettings["RedisCacheName"] + ",abortConnect=false,ssl=true,password=" + ConfigurationManager.AppSettings["RedisCachePassword"]); 39 | }); 40 | 41 | public static ConnectionMultiplexer Connection 42 | { 43 | get 44 | { 45 | return lazyConnection.Value; 46 | } 47 | } 48 | 49 | private static void DemoSetup(IDatabase cache) 50 | { 51 | cache.KeyDelete("itemkey"); 52 | cache.KeyDelete("i"); 53 | } 54 | 55 | private static string GetFromPersistentStorage(string itemKey) 56 | { 57 | return DateTime.Now.ToString(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /HelloWorld/HelloWorld.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {84A52844-AE32-4A0D-966C-D55FAF2534B0} 8 | Exe 9 | Properties 10 | HelloWorld 11 | HelloWorld 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 37 | True 38 | 39 | 40 | ..\packages\StackExchange.Redis.1.1.603\lib\net45\StackExchange.Redis.dll 41 | True 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /HelloWorld/Helper.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Configuration; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HelloWorld 10 | { 11 | public static class Helper 12 | { 13 | private static Lazy lazyConnection = new Lazy(() => 14 | { 15 | return ConnectionMultiplexer.Connect(ConfigurationManager.AppSettings["RedisCacheName"]+",abortConnect=false,ssl=true,password="+ ConfigurationManager.AppSettings["RedisCachePassword"]); 16 | }); 17 | 18 | public static ConnectionMultiplexer Connection 19 | { 20 | get 21 | { 22 | return lazyConnection.Value; 23 | } 24 | } 25 | } 26 | 27 | public class BlogPost 28 | { 29 | private HashSet tags = new HashSet(); 30 | 31 | public BlogPost(int id, string title, int score, IEnumerable tags) 32 | { 33 | this.Id = id; 34 | this.Title = title; 35 | this.Score = score; 36 | this.tags = new HashSet(tags); 37 | } 38 | 39 | public int Id { get; set; } 40 | public string Title { get; set; } 41 | public int Score { get; set; } 42 | public ICollection Tags { get { return this.tags; } } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /HelloWorld/KeySpaceNotifications.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HelloWorld 9 | { 10 | public static class KeySpaceNotifications 11 | { 12 | /// 13 | /// NOTE: For this sample to work, you need to go to the Azure Portal and configure keyspace notifications with "Kxg" to 14 | /// turn on expiration notifications (x) and general command notices (g). 15 | /// IMPORTANT - MAKE SURE YOU UNDERSTAND THE PERFORMANCE IMPACT OF TURNING ON KEYSPACE NOTIFICATIONS BEFORE PROCEEDING 16 | /// See http://redis.io/topics/notifications for more details 17 | public static void Run() 18 | { 19 | IDatabase connection = Helper.Connection.GetDatabase(); 20 | var subscriber = Helper.Connection.GetSubscriber(); 21 | int db = 0; //what Redis DB do you want notifications on? 22 | string notificationChannel = "__keyspace@" + db + "__:*"; 23 | 24 | //you only have to do this once, then your callback will be invoked. 25 | subscriber.Subscribe(notificationChannel, (channel, notificationType) => 26 | { 27 | var key = GetKey(channel); 28 | switch (notificationType) 29 | { 30 | case "expire": 31 | Console.WriteLine("Expiration Set for Key: " + key); 32 | break; 33 | case "expired": 34 | Console.WriteLine("Expiration hit for Key: " + key); 35 | break; 36 | } 37 | }); 38 | 39 | Console.WriteLine("Subscribed to notifications..."); 40 | 41 | // Demo Setup 42 | DemoSetup(connection); 43 | } 44 | 45 | private static void DemoSetup(IDatabase connection) 46 | { 47 | for (int i = 0; i < 10; i++) 48 | { 49 | connection.KeyDelete("foo" + i); 50 | } 51 | 52 | //add some keys that will expire to test the above callback that I configured. 53 | var random = new Random(); 54 | for (int i = 0; i < 10; i++) 55 | { 56 | var expiry = TimeSpan.FromMilliseconds(random.Next(1, 5)); 57 | connection.StringSet("foo" + i, "bar", expiry); 58 | 59 | } 60 | } 61 | 62 | private static string GetKey(string channel) 63 | { 64 | var index = channel.IndexOf(':'); 65 | if (index >= 0 && index < channel.Length - 1) 66 | return channel.Substring(index + 1); 67 | 68 | //we didn't find the delimeter, so just return the whole thing 69 | return channel; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /HelloWorld/Program.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HelloWorld 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | //GettingStarted.Run(); 15 | //RedisString.Run(); 16 | //GeneralConcepts.Run(); 17 | //RedisTags.Run(); 18 | //RedisLists.Run(); 19 | //RedisSortedSets.Run(); 20 | //ConnectionOptions.Run(); 21 | KeySpaceNotifications.Run(); 22 | //Clustering.Run(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /HelloWorld/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HelloWorld")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("HelloWorld")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f98722e4-0a94-4deb-85bf-98dbf8e334f7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /HelloWorld/RedisLists.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HelloWorld 10 | { 11 | /* 12 | http://redis.io/topics/data-types-intro#lists 13 | * What is it? 14 | * LinkedLists 15 | * Scenario: Add items to a long list in a fast manner in order. 16 | * Insert time constant at beginning or end 17 | * Lookup time is constant. 18 | * eg. last 5 tweets, inter process communication. 19 | * */ 20 | 21 | public static class RedisLists 22 | { 23 | public static List posts; 24 | public static List tags; 25 | public static string redisKey = "blog:recent_posts"; 26 | public static void Run() 27 | { 28 | IDatabase cache = Helper.Connection.GetDatabase(); 29 | 30 | DemoSetup(cache); 31 | 32 | // Add 5 posts as read 33 | for (int i = 0; i < 5; i++) 34 | { 35 | BlogPost blogPost = posts.Find(p => p.Id == i); // reference to the blog post that has just been read 36 | cache.ListLeftPushAsync(RedisLists.redisKey, blogPost.Title); // push the blog post onto the list 37 | } 38 | 39 | // Access the last 5 read posts 40 | Console.WriteLine("Access the last 5 read posts"); 41 | foreach (string postTitle in cache.ListRange(RedisLists.redisKey, 0, 5)) 42 | { 43 | Console.WriteLine(postTitle); 44 | } 45 | 46 | // Always show only last 5 read posts. 47 | Console.WriteLine("Always show only last 5 read posts."); 48 | cache.ListTrim(RedisLists.redisKey, 0, 5); 49 | foreach (string postTitle in cache.ListRange(RedisLists.redisKey, 0, 5)) 50 | { 51 | Console.WriteLine(postTitle); 52 | } 53 | } 54 | 55 | private static void DemoSetup(IDatabase cache) 56 | { 57 | cache.KeyDelete(RedisLists.redisKey); 58 | // Using tags to cross-correlate cached items 59 | RedisLists.tags = new List() 60 | { 61 | new string[] { "iot","csharp" }, 62 | new string[] { "iot","azure","csharp" }, 63 | new string[] { "csharp","git","big data" }, 64 | new string[] { "iot","git","database" }, 65 | new string[] { "database","git" }, 66 | new string[] { "csharp","database" }, 67 | new string[] { "iot" }, 68 | new string[] { "iot","database","git" }, 69 | new string[] { "azure","database","big data","git","csharp" }, 70 | new string[] { "azure" } 71 | }; 72 | 73 | RedisLists.posts = new List(); 74 | int blogKey = 0; 75 | int blogPostId = 0; 76 | int numberOfPosts = 20; 77 | Random random = new Random(); 78 | for (int i = 0; i < numberOfPosts; i++) 79 | { 80 | blogPostId = blogKey++; 81 | posts.Add(new BlogPost( 82 | blogPostId, // Blog post ID 83 | string.Format(CultureInfo.InvariantCulture, "Blog Post #{0}", 84 | blogPostId), // Blog post title 85 | random.Next(100, 10000), // Ranking score 86 | tags[i % tags.Count])); // Tags – assigned from a collection 87 | // in the tags list 88 | } 89 | 90 | foreach (BlogPost post in posts) 91 | { 92 | string redisKey = string.Format(CultureInfo.InvariantCulture, 93 | "blog:posts:{0}:tags", post.Id); 94 | // Add tags to the blog post in redis 95 | cache.KeyDelete(redisKey); 96 | 97 | // Now do the inverse so we can figure how which blog posts have a given tag. 98 | foreach (var tag in post.Tags) 99 | { 100 | cache.KeyDelete(string.Format(CultureInfo.InvariantCulture, 101 | "tag:{0}:blog:posts", tag)); 102 | } 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /HelloWorld/RedisSortedSets.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HelloWorld 10 | { 11 | /* 12 | * Leaderboard scenarios. 13 | * http://redis.io/topics/data-types-intro#sorted-sets 14 | * 15 | */ 16 | 17 | public static class RedisSortedSets 18 | { 19 | public static List posts; 20 | public static List tags; 21 | public static string redisKey = "blog:post_rankings"; 22 | public static void Run() 23 | { 24 | IDatabase cache = Helper.Connection.GetDatabase(); 25 | 26 | DemoSetup(cache); 27 | 28 | // Rate 5 posts 29 | for (int i = 0; i < 5; i++) 30 | { 31 | BlogPost blogPost = posts.Find(p => p.Id == i); 32 | cache.SortedSetAdd(redisKey, blogPost.Title,blogPost.Score); 33 | } 34 | 35 | Console.WriteLine("SortedSetRangeByRankWithScores"); 36 | foreach (var post in cache.SortedSetRangeByRankWithScores(redisKey)) 37 | { 38 | Console.WriteLine(post); 39 | } 40 | 41 | Console.WriteLine("SortedSetRangeByRankWithScores Descending"); 42 | foreach (var post in cache.SortedSetRangeByRankWithScores( 43 | redisKey, 0, 9, Order.Descending)) 44 | { 45 | Console.WriteLine(post); 46 | } 47 | 48 | Console.WriteLine("Blog posts with scores between 3000 and 8000"); 49 | foreach (var post in cache.SortedSetRangeByScoreWithScores( 50 | redisKey, 3000,8000)) 51 | { 52 | Console.WriteLine(post); 53 | } 54 | 55 | } 56 | 57 | private static void DemoSetup(IDatabase cache) 58 | { 59 | cache.KeyDelete(RedisSortedSets.redisKey); 60 | // Using tags to cross-correlate cached items 61 | RedisSortedSets.tags = new List() 62 | { 63 | new string[] { "iot","csharp" }, 64 | new string[] { "iot","azure","csharp" }, 65 | new string[] { "csharp","git","big data" }, 66 | new string[] { "iot","git","database" }, 67 | new string[] { "database","git" }, 68 | new string[] { "csharp","database" }, 69 | new string[] { "iot" }, 70 | new string[] { "iot","database","git" }, 71 | new string[] { "azure","database","big data","git","csharp" }, 72 | new string[] { "azure" } 73 | }; 74 | 75 | RedisSortedSets.posts = new List(); 76 | int blogKey = 0; 77 | int blogPostId = 0; 78 | int numberOfPosts = 20; 79 | Random random = new Random(); 80 | for (int i = 0; i < numberOfPosts; i++) 81 | { 82 | blogPostId = blogKey++; 83 | posts.Add(new BlogPost( 84 | blogPostId, // Blog post ID 85 | string.Format(CultureInfo.InvariantCulture, "Blog Post #{0}", 86 | blogPostId), // Blog post title 87 | random.Next(100, 10000), // Ranking score 88 | tags[i % tags.Count])); // Tags – assigned from a collection 89 | // in the tags list 90 | } 91 | 92 | foreach (BlogPost post in posts) 93 | { 94 | string redisKey = string.Format(CultureInfo.InvariantCulture, 95 | "blog:posts:{0}:tags", post.Id); 96 | // Add tags to the blog post in redis 97 | cache.KeyDelete(redisKey); 98 | 99 | // Now do the inverse so we can figure how which blog posts have a given tag. 100 | foreach (var tag in post.Tags) 101 | { 102 | cache.KeyDelete(string.Format(CultureInfo.InvariantCulture, 103 | "tag:{0}:blog:posts", tag)); 104 | } 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /HelloWorld/RedisString.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using StackExchange.Redis; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | namespace HelloWorld 11 | { 12 | public static class RedisString 13 | { 14 | public static void Run() 15 | { 16 | IDatabase cache = Helper.Connection.GetDatabase(); 17 | 18 | // Demo Setup 19 | DemoSetup(cache); 20 | 21 | //Single SET/GET 22 | cache.StringSet("i", 1); 23 | Console.WriteLine("Current Value=" + cache.StringGet("i")); 24 | 25 | //Object 26 | var contact2 = new Contact() { Id = 1, EmailAddress = "pranavra@microsoft.com", Name = "pranav" }; 27 | cache.StringSet("p", JsonConvert.SerializeObject(contact2)); 28 | var result1 = JsonConvert.DeserializeObject(cache.StringGet("p")); 29 | Console.WriteLine(result1.EmailAddress); 30 | 31 | // Key Expiration 32 | cache.StringSet("iexp1", 1, TimeSpan.FromSeconds(1)); 33 | Thread.Sleep(TimeSpan.FromSeconds(2)); 34 | Console.WriteLine("Key has expired. Value =" + cache.StringGet("iexp1")); 35 | 36 | } 37 | public class Contact 38 | { 39 | public int Id { get; set; } 40 | public string Name { get; set; } 41 | public string EmailAddress { get; set; } 42 | } 43 | 44 | private static void DemoSetup(IDatabase cache) 45 | { 46 | cache.KeyDelete("i"); 47 | cache.KeyDelete("p"); 48 | cache.KeyDelete("iexp1"); 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /HelloWorld/RedisTags.cs: -------------------------------------------------------------------------------- 1 | using StackExchange.Redis; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HelloWorld 10 | { 11 | /* 12 | * http://redis.io/topics/data-types-intro#sets 13 | */ 14 | 15 | public static class RedisTags 16 | { 17 | public static List posts; 18 | public static List tags; 19 | public static void Run() 20 | { 21 | IDatabase cache = Helper.Connection.GetDatabase(); 22 | 23 | // Demo Setup 24 | DemoSetup(cache); 25 | 26 | // Tags are easily represented as Redis Sets 27 | foreach (BlogPost post in posts) 28 | { 29 | string redisKey = string.Format(CultureInfo.InvariantCulture, 30 | "blog:posts:{0}:tags", post.Id); 31 | // Add tags to the blog post in redis 32 | cache.SetAdd( 33 | redisKey, post.Tags.Select(s => (RedisValue)s).ToArray()); 34 | 35 | // Now do the inverse so we can figure how which blog posts have a given tag. 36 | foreach (var tag in post.Tags) 37 | { 38 | cache.SetAdd(string.Format(CultureInfo.InvariantCulture, 39 | "tag:{0}:blog:posts", tag), post.Id); 40 | } 41 | } 42 | 43 | // Show the tags for blog post #1 44 | Console.WriteLine("Show the tags for blog post #1"); 45 | foreach (var value in cache.SetMembers("blog:posts:1:tags")) 46 | { 47 | Console.WriteLine(value); 48 | } 49 | 50 | 51 | // Show the tags in common for blog posts #1 and #2 52 | Console.WriteLine("Show the tags in common for blog posts #1 and #2"); 53 | foreach (var value in cache.SetCombine(SetOperation.Intersect, new RedisKey[] { "blog:posts:1:tags", "blog:posts:2:tags" })) 54 | { 55 | Console.WriteLine(value); 56 | } 57 | 58 | // Show the ids of the blog posts that have the tag "iot". 59 | Console.WriteLine("Show the ids of the blog posts that have the tag iot"); 60 | foreach (var value in cache.SetMembers("tag:iot:blog:posts")) 61 | { 62 | Console.WriteLine(value); 63 | } 64 | } 65 | 66 | private static void DemoSetup(IDatabase cache) 67 | { 68 | // Using tags to cross-correlate cached items 69 | RedisTags.tags = new List() 70 | { 71 | new string[] { "iot","csharp" }, 72 | new string[] { "iot","azure","csharp" }, 73 | new string[] { "csharp","git","big data" }, 74 | new string[] { "iot","git","database" }, 75 | new string[] { "database","git" }, 76 | new string[] { "csharp","database" }, 77 | new string[] { "iot" }, 78 | new string[] { "iot","database","git" }, 79 | new string[] { "azure","database","big data","git","csharp" }, 80 | new string[] { "azure" } 81 | }; 82 | 83 | RedisTags.posts = new List(); 84 | int blogKey = 0; 85 | int blogPostId = 0; 86 | int numberOfPosts = 20; 87 | Random random = new Random(); 88 | for (int i = 0; i < numberOfPosts; i++) 89 | { 90 | blogPostId = blogKey++; 91 | posts.Add(new BlogPost( 92 | blogPostId, // Blog post ID 93 | string.Format(CultureInfo.InvariantCulture, "Blog Post #{0}", 94 | blogPostId), // Blog post title 95 | random.Next(100, 10000), // Ranking score 96 | tags[i % tags.Count])); // Tags – assigned from a collection 97 | // in the tags list 98 | } 99 | 100 | foreach (BlogPost post in posts) 101 | { 102 | string redisKey = string.Format(CultureInfo.InvariantCulture, 103 | "blog:posts:{0}:tags", post.Id); 104 | // Add tags to the blog post in redis 105 | cache.KeyDelete(redisKey); 106 | 107 | // Now do the inverse so we can figure how which blog posts have a given tag. 108 | foreach (var tag in post.Tags) 109 | { 110 | cache.KeyDelete(string.Format(CultureInfo.InvariantCulture, 111 | "tag:{0}:blog:posts", tag)); 112 | } 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /HelloWorld/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ManageCacheUsingMAML/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ManageCacheUsingMAML/Program.cs: -------------------------------------------------------------------------------- 1 | using Hyak.Common; 2 | using Microsoft.Azure; 3 | using Microsoft.Azure.Management.Redis; 4 | using Microsoft.Azure.Management.Redis.Models; 5 | using Microsoft.IdentityModel.Clients.ActiveDirectory; 6 | using Microsoft.Rest; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace ManageCacheUsingMAML 15 | { 16 | class Program 17 | { 18 | public static string subscriptionId = ""; //Get this from the Azure Portal 19 | public static string resourceGroupName = "";//Get this from the Azure Portal 20 | public static string cacheName = ""; // This is just the name (without redis.cache.windows.net) 21 | public static string redisSKUName = "Premium"; //Basic/ Standard/ Premium 22 | public static string redisSKUFamily = "P"; 23 | public static int redisSKUCapacity = 1; //Cache Size 0-6. More details http://azure.microsoft.com/en-us/pricing/details/cache/ 24 | public static string redisCacheRegion = "West US"; 25 | 26 | // Use the following link to learn how to setup this app to access Active Directory 27 | // https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx#bk_portal 28 | public static string tenantId = ""; 29 | public static string clientId = ""; 30 | public static string redirectUri = ""; 31 | public static string clientSecrets = ""; 32 | 33 | static void Main(string[] args) 34 | { 35 | //https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx#bk_portal 36 | string token = GetAuthorizationHeader(); 37 | 38 | TokenCredentials creds = new TokenCredentials(token); 39 | RedisManagementClient client = new RedisManagementClient(creds); 40 | client.SubscriptionId = subscriptionId; 41 | var redisParams = new RedisCreateOrUpdateParameters() 42 | { 43 | Sku = new Sku(redisSKUName, redisSKUFamily, redisSKUCapacity), 44 | Location = redisCacheRegion 45 | }; 46 | client.Redis.CreateOrUpdate(resourceGroupName,cacheName, redisParams); 47 | } 48 | 49 | private static string GetAuthorizationHeader() 50 | { 51 | AuthenticationResult result = null; 52 | 53 | var context = new AuthenticationContext(String.Format("https://login.windows.net/{0}", tenantId)); 54 | 55 | var thread = new Thread(() => 56 | { 57 | var authParam = new PlatformParameters(PromptBehavior.Never, null); 58 | result = context.AcquireTokenAsync( 59 | "https://management.core.windows.net/", 60 | new ClientCredential(clientId, clientSecrets)).Result; 61 | }); 62 | 63 | thread.SetApartmentState(ApartmentState.STA); 64 | thread.Name = "AquireTokenThread"; 65 | thread.Start(); 66 | thread.Join(); 67 | 68 | 69 | if (result == null) 70 | { 71 | throw new InvalidOperationException("Failed to obtain the JWT token"); 72 | } 73 | 74 | string token = result.AccessToken; 75 | return token; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ManageCacheUsingMAML/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ManageCacheUsingMAML")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ManageCacheUsingMAML")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("57a815d9-c4fc-42dd-93a9-b5aac24ba25a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ManageCacheUsingMAML/README.md: -------------------------------------------------------------------------------- 1 | Manage Azure Redis Cache using Azure Management Libraries 2 | ==================================== 3 | 4 | ===================== 5 | This sample demonstrates how can you use Azure Management Libraries to manage - (Create/ Update/ delete) your Cache. 6 | It uses the following NuGet package http://www.nuget.org/packages/Microsoft.Azure.Management.Redis/0.14.1-preview 7 | 8 | ## How To Run This Sample 9 | 10 | 11 | You need the following information from Azure Portal 12 | 13 | - Setup your app for Authenticating Azure Resource Manager with Active Directory. For How-To instructions please read https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx#bk_portal 14 | 15 | - Your SubscriptionId 16 | 17 | - ResourceGroupName where the Redis is CacheA 18 | - Cache Name. This is just the name (without redis.cache.windows.net) 19 | 20 | 21 | - You can set more values specific to your Cache such as Cache Size, Region etc. in code. -------------------------------------------------------------------------------- /ManageCacheUsingMAML/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Redis Samples 2 | ============= 3 | Samples for Azure Redis Cache 4 | 5 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace RedisAsSignalRBackplane 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace RedisAsSignalRBackplane 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/App_Start/RegisterHubs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Routing; 6 | 7 | //[assembly: PreApplicationStartMethod(typeof(RedisAsSignalRBackplane.RegisterHubs), "Start")] 8 | 9 | namespace RedisAsSignalRBackplane 10 | { 11 | public static class RegisterHubs 12 | { 13 | public static void Start() 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace RedisAsSignalRBackplane 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace Firework.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | // 12 | // GET: /Home/ 13 | 14 | public ActionResult Index(int type = 1, int color = 1) 15 | { 16 | ViewBag.FireworkType = type; 17 | ViewBag.FireworkColorIndex = color; 18 | return View(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/FireworkHub.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.SignalR; 2 | using Microsoft.AspNet.SignalR.Hubs; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web; 7 | 8 | namespace Firework 9 | { 10 | [HubName("fireworkHub")] 11 | public class FireworkHub : Hub 12 | { 13 | public void Add(int type, double x, double y, string color, int tail) 14 | { 15 | Clients.All.addFirework( 16 | new 17 | { 18 | Type = type, 19 | X = x, 20 | Y = y, 21 | Color = color, 22 | TailType = tail 23 | } 24 | ); 25 | } 26 | public FireworkHub() 27 | { 28 | 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="RedisAsSignalRBackplane.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace RedisAsSignalRBackplane 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | //BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_0.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_0_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_0_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_1.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_1_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_1_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_2.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_2_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_2_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_3.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_3_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_3_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_4.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_4_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_4_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_5.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_5_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_5_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_6.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/c_6_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/c_6_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_0.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_0_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_0_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_1.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_1_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_1_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_2.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/r_2_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/r_2_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/t_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/t_0.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/t_0_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/t_0_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/t_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/t_1.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Images/t_1_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Images/t_1_h.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Project_Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Your ASP.NET application 6 | 95 | 96 | 97 | 98 | 102 | 103 |
104 |
105 |

This application consists of:

106 |
    107 |
  • Sample pages showing basic nav between Home, About, and Contact
  • 108 |
  • Theming using Bootstrap
  • 109 |
  • Authentication, if selected, shows how to register and sign in
  • 110 |
  • ASP.NET features managed using NuGet
  • 111 |
112 |
113 | 114 | 131 | 132 |
133 |

Deploy

134 | 139 |
140 | 141 |
142 |

Get help

143 | 147 |
148 |
149 | 150 | 151 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedisAsSignalRBackplane")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedisAsSignalRBackplane")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f49f7010-dea1-4f4b-9e98-f178c25356b4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/README.md: -------------------------------------------------------------------------------- 1 | Use Redis Cache as a Scale out Backplane for ASP.NET SignalR 2 | ========================================================= 3 | This sample demonstrates how you can use Azure Redis Cache as a SignalR backplane. 4 | More details about backplane are http://www.asp.net/signalr/overview/performance/scaleout-with-redis 5 | This samples was used to demo this scenario 6 | 7 | ## How To Run This Sample 8 | 9 | 10 | You need the following information from Azure Portal 11 | 12 | - Create a Cache https://msdn.microsoft.com/en-us/library/dn690516.aspx 13 | - Copy the Cache Name and Keys and set in Web.config. You can also set it as AppSetting for your Azure Website 14 | - Enable Non-SSL port (6379) in your Cache settings 15 | - Startup.cs has the code to wire up Redis as a backplane 16 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/Scripts/_references.js -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this);b.data("validator").resetForm();b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){return a(b.form).find(":input").filter("[name='"+f(c)+"']").val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); 18 | 19 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 20 | (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin; 4 | using Owin; 5 | using Microsoft.AspNet.SignalR; 6 | using Microsoft.AspNet.SignalR.Redis; 7 | using System.Configuration; 8 | 9 | [assembly: OwinStartup(typeof(Firework.Startup))] 10 | 11 | namespace Firework 12 | { 13 | public class Startup 14 | { 15 | public void Configuration(IAppBuilder app) 16 | { 17 | GlobalHost.DependencyResolver.UseRedis(ConfigurationManager.AppSettings["mCacheUrl"], 6379, ConfigurationManager.AppSettings["mCachePassword"], "Fireworks"); 18 | app.MapSignalR(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/favicon.ico -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/nightcity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisAsSignalRBackplane/nightcity.png -------------------------------------------------------------------------------- /RedisAsSignalRBackplane/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace RedisCacheCustomerQuerySample 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 15 | "~/Scripts/jquery.validate*")); 16 | 17 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 18 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 19 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 20 | "~/Scripts/modernizr-*")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 23 | "~/Scripts/bootstrap.js", 24 | "~/Scripts/respond.js")); 25 | 26 | bundles.Add(new StyleBundle("~/Content/css").Include( 27 | "~/Content/bootstrap.css", 28 | "~/Content/site.css")); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace RedisCacheCustomerQuerySample 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace RedisCacheCustomerQuerySample 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace CustomerQuery 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | config.MapHttpAttributeRoutes(); 13 | 14 | config.Routes.MapHttpRoute( 15 | name: "DefaultApi", 16 | routeTemplate: "api/{controller}/{id}", 17 | defaults: new { id = RouteParameter.Optional } 18 | ); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Override the default bootstrap behavior where horizontal description lists 13 | will truncate terms that are too long to fit in the left column 14 | */ 15 | .dl-horizontal dt { 16 | white-space: normal; 17 | } 18 | 19 | /* Set width on the form input elements since they're 100% wide by default */ 20 | input, 21 | select, 22 | textarea { 23 | max-width: 280px; 24 | } 25 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/accordion.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Accordion 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/accordion/#theming 10 | */ 11 | .ui-accordion .ui-accordion-header { 12 | display: block; 13 | cursor: pointer; 14 | position: relative; 15 | margin: 2px 0 0 0; 16 | padding: .5em .5em .5em .7em; 17 | min-height: 0; /* support: IE7 */ 18 | font-size: 100%; 19 | } 20 | .ui-accordion .ui-accordion-icons { 21 | padding-left: 2.2em; 22 | } 23 | .ui-accordion .ui-accordion-icons .ui-accordion-icons { 24 | padding-left: 2.2em; 25 | } 26 | .ui-accordion .ui-accordion-header .ui-accordion-header-icon { 27 | position: absolute; 28 | left: .5em; 29 | top: 50%; 30 | margin-top: -8px; 31 | } 32 | .ui-accordion .ui-accordion-content { 33 | padding: 1em 2.2em; 34 | border-top: 0; 35 | overflow: auto; 36 | } 37 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/all.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | @import "base.css"; 12 | @import "theme.css"; 13 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/autocomplete.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Autocomplete 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/autocomplete/#theming 10 | */ 11 | .ui-autocomplete { 12 | position: absolute; 13 | top: 0; 14 | left: 0; 15 | cursor: default; 16 | } 17 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/base.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | @import url("core.css"); 12 | 13 | @import url("accordion.css"); 14 | @import url("autocomplete.css"); 15 | @import url("button.css"); 16 | @import url("datepicker.css"); 17 | @import url("dialog.css"); 18 | @import url("draggable.css"); 19 | @import url("menu.css"); 20 | @import url("progressbar.css"); 21 | @import url("resizable.css"); 22 | @import url("selectable.css"); 23 | @import url("selectmenu.css"); 24 | @import url("sortable.css"); 25 | @import url("slider.css"); 26 | @import url("spinner.css"); 27 | @import url("tabs.css"); 28 | @import url("tooltip.css"); 29 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/button.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Button 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/button/#theming 10 | */ 11 | .ui-button { 12 | display: inline-block; 13 | position: relative; 14 | padding: 0; 15 | line-height: normal; 16 | margin-right: .1em; 17 | cursor: pointer; 18 | vertical-align: middle; 19 | text-align: center; 20 | overflow: visible; /* removes extra width in IE */ 21 | } 22 | .ui-button, 23 | .ui-button:link, 24 | .ui-button:visited, 25 | .ui-button:hover, 26 | .ui-button:active { 27 | text-decoration: none; 28 | } 29 | /* to make room for the icon, a width needs to be set here */ 30 | .ui-button-icon-only { 31 | width: 2.2em; 32 | } 33 | /* button elements seem to need a little more width */ 34 | button.ui-button-icon-only { 35 | width: 2.4em; 36 | } 37 | .ui-button-icons-only { 38 | width: 3.4em; 39 | } 40 | button.ui-button-icons-only { 41 | width: 3.7em; 42 | } 43 | 44 | /* button text element */ 45 | .ui-button .ui-button-text { 46 | display: block; 47 | line-height: normal; 48 | } 49 | .ui-button-text-only .ui-button-text { 50 | padding: .4em 1em; 51 | } 52 | .ui-button-icon-only .ui-button-text, 53 | .ui-button-icons-only .ui-button-text { 54 | padding: .4em; 55 | text-indent: -9999999px; 56 | } 57 | .ui-button-text-icon-primary .ui-button-text, 58 | .ui-button-text-icons .ui-button-text { 59 | padding: .4em 1em .4em 2.1em; 60 | } 61 | .ui-button-text-icon-secondary .ui-button-text, 62 | .ui-button-text-icons .ui-button-text { 63 | padding: .4em 2.1em .4em 1em; 64 | } 65 | .ui-button-text-icons .ui-button-text { 66 | padding-left: 2.1em; 67 | padding-right: 2.1em; 68 | } 69 | /* no icon support for input elements, provide padding by default */ 70 | input.ui-button { 71 | padding: .4em 1em; 72 | } 73 | 74 | /* button icon element(s) */ 75 | .ui-button-icon-only .ui-icon, 76 | .ui-button-text-icon-primary .ui-icon, 77 | .ui-button-text-icon-secondary .ui-icon, 78 | .ui-button-text-icons .ui-icon, 79 | .ui-button-icons-only .ui-icon { 80 | position: absolute; 81 | top: 50%; 82 | margin-top: -8px; 83 | } 84 | .ui-button-icon-only .ui-icon { 85 | left: 50%; 86 | margin-left: -8px; 87 | } 88 | .ui-button-text-icon-primary .ui-button-icon-primary, 89 | .ui-button-text-icons .ui-button-icon-primary, 90 | .ui-button-icons-only .ui-button-icon-primary { 91 | left: .5em; 92 | } 93 | .ui-button-text-icon-secondary .ui-button-icon-secondary, 94 | .ui-button-text-icons .ui-button-icon-secondary, 95 | .ui-button-icons-only .ui-button-icon-secondary { 96 | right: .5em; 97 | } 98 | 99 | /* button sets */ 100 | .ui-buttonset { 101 | margin-right: 7px; 102 | } 103 | .ui-buttonset .ui-button { 104 | margin-left: 0; 105 | margin-right: -.3em; 106 | } 107 | 108 | /* workarounds */ 109 | /* reset extra padding in Firefox, see h5bp.com/l */ 110 | input.ui-button::-moz-focus-inner, 111 | button.ui-button::-moz-focus-inner { 112 | border: 0; 113 | padding: 0; 114 | } 115 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/core.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | 12 | /* Layout helpers 13 | ----------------------------------*/ 14 | .ui-helper-hidden { 15 | display: none; 16 | } 17 | .ui-helper-hidden-accessible { 18 | border: 0; 19 | clip: rect(0 0 0 0); 20 | height: 1px; 21 | margin: -1px; 22 | overflow: hidden; 23 | padding: 0; 24 | position: absolute; 25 | width: 1px; 26 | } 27 | .ui-helper-reset { 28 | margin: 0; 29 | padding: 0; 30 | border: 0; 31 | outline: 0; 32 | line-height: 1.3; 33 | text-decoration: none; 34 | font-size: 100%; 35 | list-style: none; 36 | } 37 | .ui-helper-clearfix:before, 38 | .ui-helper-clearfix:after { 39 | content: ""; 40 | display: table; 41 | border-collapse: collapse; 42 | } 43 | .ui-helper-clearfix:after { 44 | clear: both; 45 | } 46 | .ui-helper-clearfix { 47 | min-height: 0; /* support: IE7 */ 48 | } 49 | .ui-helper-zfix { 50 | width: 100%; 51 | height: 100%; 52 | top: 0; 53 | left: 0; 54 | position: absolute; 55 | opacity: 0; 56 | filter:Alpha(Opacity=0); /* support: IE8 */ 57 | } 58 | 59 | .ui-front { 60 | z-index: 100; 61 | } 62 | 63 | 64 | /* Interaction Cues 65 | ----------------------------------*/ 66 | .ui-state-disabled { 67 | cursor: default !important; 68 | } 69 | 70 | 71 | /* Icons 72 | ----------------------------------*/ 73 | 74 | /* states and images */ 75 | .ui-icon { 76 | display: block; 77 | text-indent: -99999px; 78 | overflow: hidden; 79 | background-repeat: no-repeat; 80 | } 81 | 82 | 83 | /* Misc visuals 84 | ----------------------------------*/ 85 | 86 | /* Overlays */ 87 | .ui-widget-overlay { 88 | position: fixed; 89 | top: 0; 90 | left: 0; 91 | width: 100%; 92 | height: 100%; 93 | } 94 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/datepicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Datepicker 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/datepicker/#theming 10 | */ 11 | .ui-datepicker { 12 | width: 17em; 13 | padding: .2em .2em 0; 14 | display: none; 15 | } 16 | .ui-datepicker .ui-datepicker-header { 17 | position: relative; 18 | padding: .2em 0; 19 | } 20 | .ui-datepicker .ui-datepicker-prev, 21 | .ui-datepicker .ui-datepicker-next { 22 | position: absolute; 23 | top: 2px; 24 | width: 1.8em; 25 | height: 1.8em; 26 | } 27 | .ui-datepicker .ui-datepicker-prev-hover, 28 | .ui-datepicker .ui-datepicker-next-hover { 29 | top: 1px; 30 | } 31 | .ui-datepicker .ui-datepicker-prev { 32 | left: 2px; 33 | } 34 | .ui-datepicker .ui-datepicker-next { 35 | right: 2px; 36 | } 37 | .ui-datepicker .ui-datepicker-prev-hover { 38 | left: 1px; 39 | } 40 | .ui-datepicker .ui-datepicker-next-hover { 41 | right: 1px; 42 | } 43 | .ui-datepicker .ui-datepicker-prev span, 44 | .ui-datepicker .ui-datepicker-next span { 45 | display: block; 46 | position: absolute; 47 | left: 50%; 48 | margin-left: -8px; 49 | top: 50%; 50 | margin-top: -8px; 51 | } 52 | .ui-datepicker .ui-datepicker-title { 53 | margin: 0 2.3em; 54 | line-height: 1.8em; 55 | text-align: center; 56 | } 57 | .ui-datepicker .ui-datepicker-title select { 58 | font-size: 1em; 59 | margin: 1px 0; 60 | } 61 | .ui-datepicker select.ui-datepicker-month, 62 | .ui-datepicker select.ui-datepicker-year { 63 | width: 45%; 64 | } 65 | .ui-datepicker table { 66 | width: 100%; 67 | font-size: .9em; 68 | border-collapse: collapse; 69 | margin: 0 0 .4em; 70 | } 71 | .ui-datepicker th { 72 | padding: .7em .3em; 73 | text-align: center; 74 | font-weight: bold; 75 | border: 0; 76 | } 77 | .ui-datepicker td { 78 | border: 0; 79 | padding: 1px; 80 | } 81 | .ui-datepicker td span, 82 | .ui-datepicker td a { 83 | display: block; 84 | padding: .2em; 85 | text-align: right; 86 | text-decoration: none; 87 | } 88 | .ui-datepicker .ui-datepicker-buttonpane { 89 | background-image: none; 90 | margin: .7em 0 0 0; 91 | padding: 0 .2em; 92 | border-left: 0; 93 | border-right: 0; 94 | border-bottom: 0; 95 | } 96 | .ui-datepicker .ui-datepicker-buttonpane button { 97 | float: right; 98 | margin: .5em .2em .4em; 99 | cursor: pointer; 100 | padding: .2em .6em .3em .6em; 101 | width: auto; 102 | overflow: visible; 103 | } 104 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { 105 | float: left; 106 | } 107 | 108 | /* with multiple calendars */ 109 | .ui-datepicker.ui-datepicker-multi { 110 | width: auto; 111 | } 112 | .ui-datepicker-multi .ui-datepicker-group { 113 | float: left; 114 | } 115 | .ui-datepicker-multi .ui-datepicker-group table { 116 | width: 95%; 117 | margin: 0 auto .4em; 118 | } 119 | .ui-datepicker-multi-2 .ui-datepicker-group { 120 | width: 50%; 121 | } 122 | .ui-datepicker-multi-3 .ui-datepicker-group { 123 | width: 33.3%; 124 | } 125 | .ui-datepicker-multi-4 .ui-datepicker-group { 126 | width: 25%; 127 | } 128 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, 129 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { 130 | border-left-width: 0; 131 | } 132 | .ui-datepicker-multi .ui-datepicker-buttonpane { 133 | clear: left; 134 | } 135 | .ui-datepicker-row-break { 136 | clear: both; 137 | width: 100%; 138 | font-size: 0; 139 | } 140 | 141 | /* RTL support */ 142 | .ui-datepicker-rtl { 143 | direction: rtl; 144 | } 145 | .ui-datepicker-rtl .ui-datepicker-prev { 146 | right: 2px; 147 | left: auto; 148 | } 149 | .ui-datepicker-rtl .ui-datepicker-next { 150 | left: 2px; 151 | right: auto; 152 | } 153 | .ui-datepicker-rtl .ui-datepicker-prev:hover { 154 | right: 1px; 155 | left: auto; 156 | } 157 | .ui-datepicker-rtl .ui-datepicker-next:hover { 158 | left: 1px; 159 | right: auto; 160 | } 161 | .ui-datepicker-rtl .ui-datepicker-buttonpane { 162 | clear: right; 163 | } 164 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { 165 | float: left; 166 | } 167 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, 168 | .ui-datepicker-rtl .ui-datepicker-group { 169 | float: right; 170 | } 171 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, 172 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { 173 | border-right-width: 0; 174 | border-left-width: 1px; 175 | } 176 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/dialog.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Dialog 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/dialog/#theming 10 | */ 11 | .ui-dialog { 12 | overflow: hidden; 13 | position: absolute; 14 | top: 0; 15 | left: 0; 16 | padding: .2em; 17 | outline: 0; 18 | } 19 | .ui-dialog .ui-dialog-titlebar { 20 | padding: .4em 1em; 21 | position: relative; 22 | } 23 | .ui-dialog .ui-dialog-title { 24 | float: left; 25 | margin: .1em 0; 26 | white-space: nowrap; 27 | width: 90%; 28 | overflow: hidden; 29 | text-overflow: ellipsis; 30 | } 31 | .ui-dialog .ui-dialog-titlebar-close { 32 | position: absolute; 33 | right: .3em; 34 | top: 50%; 35 | width: 20px; 36 | margin: -10px 0 0 0; 37 | padding: 1px; 38 | height: 20px; 39 | } 40 | .ui-dialog .ui-dialog-content { 41 | position: relative; 42 | border: 0; 43 | padding: .5em 1em; 44 | background: none; 45 | overflow: auto; 46 | } 47 | .ui-dialog .ui-dialog-buttonpane { 48 | text-align: left; 49 | border-width: 1px 0 0 0; 50 | background-image: none; 51 | margin-top: .5em; 52 | padding: .3em 1em .5em .4em; 53 | } 54 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { 55 | float: right; 56 | } 57 | .ui-dialog .ui-dialog-buttonpane button { 58 | margin: .5em .4em .5em 0; 59 | cursor: pointer; 60 | } 61 | .ui-dialog .ui-resizable-se { 62 | width: 12px; 63 | height: 12px; 64 | right: -5px; 65 | bottom: -5px; 66 | background-position: 16px 16px; 67 | } 68 | .ui-draggable .ui-dialog-titlebar { 69 | cursor: move; 70 | } 71 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/draggable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Draggable 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | */ 9 | .ui-draggable-handle { 10 | -ms-touch-action: none; 11 | touch-action: none; 12 | } 13 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/Content/themes/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/menu.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Menu 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/menu/#theming 10 | */ 11 | .ui-menu { 12 | list-style: none; 13 | padding: 0; 14 | margin: 0; 15 | display: block; 16 | outline: none; 17 | } 18 | .ui-menu .ui-menu { 19 | position: absolute; 20 | } 21 | .ui-menu .ui-menu-item { 22 | position: relative; 23 | margin: 0; 24 | padding: 3px 1em 3px .4em; 25 | cursor: pointer; 26 | min-height: 0; /* support: IE7 */ 27 | /* support: IE10, see #8844 */ 28 | list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); 29 | } 30 | .ui-menu .ui-menu-divider { 31 | margin: 5px 0; 32 | height: 0; 33 | font-size: 0; 34 | line-height: 0; 35 | border-width: 1px 0 0 0; 36 | } 37 | .ui-menu .ui-state-focus, 38 | .ui-menu .ui-state-active { 39 | margin: -1px; 40 | } 41 | 42 | /* icon support */ 43 | .ui-menu-icons { 44 | position: relative; 45 | } 46 | .ui-menu-icons .ui-menu-item { 47 | padding-left: 2em; 48 | } 49 | 50 | /* left-aligned */ 51 | .ui-menu .ui-icon { 52 | position: absolute; 53 | top: 0; 54 | bottom: 0; 55 | left: .2em; 56 | margin: auto 0; 57 | } 58 | 59 | /* right-aligned */ 60 | .ui-menu .ui-menu-icon { 61 | left: auto; 62 | right: 0; 63 | } 64 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/progressbar.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Progressbar 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/progressbar/#theming 10 | */ 11 | .ui-progressbar { 12 | height: 2em; 13 | text-align: left; 14 | overflow: hidden; 15 | } 16 | .ui-progressbar .ui-progressbar-value { 17 | margin: -1px; 18 | height: 100%; 19 | } 20 | .ui-progressbar .ui-progressbar-overlay { 21 | background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); 22 | height: 100%; 23 | filter: alpha(opacity=25); /* support: IE8 */ 24 | opacity: 0.25; 25 | } 26 | .ui-progressbar-indeterminate .ui-progressbar-value { 27 | background-image: none; 28 | } 29 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/resizable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Resizable 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | */ 9 | .ui-resizable { 10 | position: relative; 11 | } 12 | .ui-resizable-handle { 13 | position: absolute; 14 | font-size: 0.1px; 15 | display: block; 16 | -ms-touch-action: none; 17 | touch-action: none; 18 | } 19 | .ui-resizable-disabled .ui-resizable-handle, 20 | .ui-resizable-autohide .ui-resizable-handle { 21 | display: none; 22 | } 23 | .ui-resizable-n { 24 | cursor: n-resize; 25 | height: 7px; 26 | width: 100%; 27 | top: -5px; 28 | left: 0; 29 | } 30 | .ui-resizable-s { 31 | cursor: s-resize; 32 | height: 7px; 33 | width: 100%; 34 | bottom: -5px; 35 | left: 0; 36 | } 37 | .ui-resizable-e { 38 | cursor: e-resize; 39 | width: 7px; 40 | right: -5px; 41 | top: 0; 42 | height: 100%; 43 | } 44 | .ui-resizable-w { 45 | cursor: w-resize; 46 | width: 7px; 47 | left: -5px; 48 | top: 0; 49 | height: 100%; 50 | } 51 | .ui-resizable-se { 52 | cursor: se-resize; 53 | width: 12px; 54 | height: 12px; 55 | right: 1px; 56 | bottom: 1px; 57 | } 58 | .ui-resizable-sw { 59 | cursor: sw-resize; 60 | width: 9px; 61 | height: 9px; 62 | left: -5px; 63 | bottom: -5px; 64 | } 65 | .ui-resizable-nw { 66 | cursor: nw-resize; 67 | width: 9px; 68 | height: 9px; 69 | left: -5px; 70 | top: -5px; 71 | } 72 | .ui-resizable-ne { 73 | cursor: ne-resize; 74 | width: 9px; 75 | height: 9px; 76 | right: -5px; 77 | top: -5px; 78 | } 79 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/selectable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Selectable 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | */ 9 | .ui-selectable { 10 | -ms-touch-action: none; 11 | touch-action: none; 12 | } 13 | .ui-selectable-helper { 14 | position: absolute; 15 | z-index: 100; 16 | border: 1px dotted black; 17 | } 18 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/selectmenu.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Selectmenu 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/selectmenu/#theming 10 | */ 11 | .ui-selectmenu-menu { 12 | padding: 0; 13 | margin: 0; 14 | position: absolute; 15 | top: 0; 16 | left: 0; 17 | display: none; 18 | } 19 | .ui-selectmenu-menu .ui-menu { 20 | overflow: auto; 21 | /* Support: IE7 */ 22 | overflow-x: hidden; 23 | padding-bottom: 1px; 24 | } 25 | .ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { 26 | font-size: 1em; 27 | font-weight: bold; 28 | line-height: 1.5; 29 | padding: 2px 0.4em; 30 | margin: 0.5em 0 0 0; 31 | height: auto; 32 | border: 0; 33 | } 34 | .ui-selectmenu-open { 35 | display: block; 36 | } 37 | .ui-selectmenu-button { 38 | display: inline-block; 39 | overflow: hidden; 40 | position: relative; 41 | text-decoration: none; 42 | cursor: pointer; 43 | } 44 | .ui-selectmenu-button span.ui-icon { 45 | right: 0.5em; 46 | left: auto; 47 | margin-top: -8px; 48 | position: absolute; 49 | top: 50%; 50 | } 51 | .ui-selectmenu-button span.ui-selectmenu-text { 52 | text-align: left; 53 | padding: 0.4em 2.1em 0.4em 1em; 54 | display: block; 55 | line-height: 1.4; 56 | overflow: hidden; 57 | text-overflow: ellipsis; 58 | white-space: nowrap; 59 | } 60 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/slider.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Slider 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/slider/#theming 10 | */ 11 | .ui-slider { 12 | position: relative; 13 | text-align: left; 14 | } 15 | .ui-slider .ui-slider-handle { 16 | position: absolute; 17 | z-index: 2; 18 | width: 1.2em; 19 | height: 1.2em; 20 | cursor: default; 21 | -ms-touch-action: none; 22 | touch-action: none; 23 | } 24 | .ui-slider .ui-slider-range { 25 | position: absolute; 26 | z-index: 1; 27 | font-size: .7em; 28 | display: block; 29 | border: 0; 30 | background-position: 0 0; 31 | } 32 | 33 | /* support: IE8 - See #6727 */ 34 | .ui-slider.ui-state-disabled .ui-slider-handle, 35 | .ui-slider.ui-state-disabled .ui-slider-range { 36 | filter: inherit; 37 | } 38 | 39 | .ui-slider-horizontal { 40 | height: .8em; 41 | } 42 | .ui-slider-horizontal .ui-slider-handle { 43 | top: -.3em; 44 | margin-left: -.6em; 45 | } 46 | .ui-slider-horizontal .ui-slider-range { 47 | top: 0; 48 | height: 100%; 49 | } 50 | .ui-slider-horizontal .ui-slider-range-min { 51 | left: 0; 52 | } 53 | .ui-slider-horizontal .ui-slider-range-max { 54 | right: 0; 55 | } 56 | 57 | .ui-slider-vertical { 58 | width: .8em; 59 | height: 100px; 60 | } 61 | .ui-slider-vertical .ui-slider-handle { 62 | left: -.3em; 63 | margin-left: 0; 64 | margin-bottom: -.6em; 65 | } 66 | .ui-slider-vertical .ui-slider-range { 67 | left: 0; 68 | width: 100%; 69 | } 70 | .ui-slider-vertical .ui-slider-range-min { 71 | bottom: 0; 72 | } 73 | .ui-slider-vertical .ui-slider-range-max { 74 | top: 0; 75 | } 76 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/sortable.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Sortable 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | */ 9 | .ui-sortable-handle { 10 | -ms-touch-action: none; 11 | touch-action: none; 12 | } 13 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/spinner.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Spinner 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/spinner/#theming 10 | */ 11 | .ui-spinner { 12 | position: relative; 13 | display: inline-block; 14 | overflow: hidden; 15 | padding: 0; 16 | vertical-align: middle; 17 | } 18 | .ui-spinner-input { 19 | border: none; 20 | background: none; 21 | color: inherit; 22 | padding: 0; 23 | margin: .2em 0; 24 | vertical-align: middle; 25 | margin-left: .4em; 26 | margin-right: 22px; 27 | } 28 | .ui-spinner-button { 29 | width: 16px; 30 | height: 50%; 31 | font-size: .5em; 32 | padding: 0; 33 | margin: 0; 34 | text-align: center; 35 | position: absolute; 36 | cursor: default; 37 | display: block; 38 | overflow: hidden; 39 | right: 0; 40 | } 41 | /* more specificity required here to override default borders */ 42 | .ui-spinner a.ui-spinner-button { 43 | border-top: none; 44 | border-bottom: none; 45 | border-right: none; 46 | } 47 | /* vertically center icon */ 48 | .ui-spinner .ui-icon { 49 | position: absolute; 50 | margin-top: -8px; 51 | top: 50%; 52 | left: 0; 53 | } 54 | .ui-spinner-up { 55 | top: 0; 56 | } 57 | .ui-spinner-down { 58 | bottom: 0; 59 | } 60 | 61 | /* TR overrides */ 62 | .ui-spinner .ui-icon-triangle-1-s { 63 | /* need to fix icons sprite */ 64 | background-position: -65px -16px; 65 | } 66 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/tabs.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Tabs 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/tabs/#theming 10 | */ 11 | .ui-tabs { 12 | position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ 13 | padding: .2em; 14 | } 15 | .ui-tabs .ui-tabs-nav { 16 | margin: 0; 17 | padding: .2em .2em 0; 18 | } 19 | .ui-tabs .ui-tabs-nav li { 20 | list-style: none; 21 | float: left; 22 | position: relative; 23 | top: 0; 24 | margin: 1px .2em 0 0; 25 | border-bottom-width: 0; 26 | padding: 0; 27 | white-space: nowrap; 28 | } 29 | .ui-tabs .ui-tabs-nav .ui-tabs-anchor { 30 | float: left; 31 | padding: .5em 1em; 32 | text-decoration: none; 33 | } 34 | .ui-tabs .ui-tabs-nav li.ui-tabs-active { 35 | margin-bottom: -1px; 36 | padding-bottom: 1px; 37 | } 38 | .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, 39 | .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, 40 | .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { 41 | cursor: text; 42 | } 43 | .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { 44 | cursor: pointer; 45 | } 46 | .ui-tabs .ui-tabs-panel { 47 | display: block; 48 | border-width: 0; 49 | padding: 1em 1.4em; 50 | background: none; 51 | } 52 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Content/themes/base/tooltip.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI Tooltip 1.11.3 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/tooltip/#theming 10 | */ 11 | .ui-tooltip { 12 | padding: 8px; 13 | position: absolute; 14 | z-index: 9999; 15 | max-width: 300px; 16 | -webkit-box-shadow: 0 0 5px #aaa; 17 | box-shadow: 0 0 5px #aaa; 18 | } 19 | body .ui-tooltip { 20 | border-width: 2px; 21 | } 22 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Controllers/AutoCompleteController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Web.Http; 8 | 9 | namespace CustomerQuery.Controllers 10 | { 11 | public class AutoCompleteController : ApiController 12 | { 13 | public List Get(string prefix) 14 | { 15 | List ret = new List(); 16 | BookSleeve.RedisConnection connection = new BookSleeve.RedisConnection(ConfigurationManager.AppSettings["mCacheUrl"], 17 | password: ConfigurationManager.AppSettings["mCachePassword"]); 18 | connection.Open(); 19 | var list = connection.Wait(connection.Keys.Find(0, "cust:" + prefix.Replace(' ', ':') + "*")); 20 | for (int i = 0; i < Math.Min(5, list.Length); i++) 21 | { 22 | ret.Add(list[i].Substring(5).Replace(':',' ')); 23 | } 24 | connection.Close(false); 25 | return ret; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Controllers/ProductAutoCompleteController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Web.Http; 8 | 9 | namespace CustomerQuery.Controllers 10 | { 11 | public class ProductAutoCompleteController : ApiController 12 | { 13 | public List Get(string prefix, string category) 14 | { 15 | List ret = new List(); 16 | BookSleeve.RedisConnection connection = new BookSleeve.RedisConnection(ConfigurationManager.AppSettings["mCacheUrl2"], 17 | password: ConfigurationManager.AppSettings["mCachePassword2"]); 18 | connection.Open(); 19 | var list = connection.Wait(connection.Keys.Find(0, "prod:" + category + ":" + prefix.Replace(' ', ':') + "*")); 20 | for (int i = 0; i < Math.Min(5, list.Length); i++) 21 | { 22 | string s = list[i].Substring(5); 23 | s = s.Substring(s.IndexOf(':') + 1); 24 | ret.Add(s.Replace(':',' ')); 25 | } 26 | connection.Close(false); 27 | return ret; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="RedisCacheCustomerQuerySample.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using CustomerQuery; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Http; 7 | using System.Web.Mvc; 8 | using System.Web.Optimization; 9 | using System.Web.Routing; 10 | 11 | namespace RedisCacheCustomerQuerySample 12 | { 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | protected void Application_Start() 16 | { 17 | GlobalConfiguration.Configure(WebApiConfig.Register); 18 | AreaRegistration.RegisterAllAreas(); 19 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 20 | RouteConfig.RegisterRoutes(RouteTable.Routes); 21 | BundleConfig.RegisterBundles(BundleTable.Bundles); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Models/HomeViewModel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.WindowsAzure.Storage.Table; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.Linq; 6 | using System.Web; 7 | 8 | namespace CustomerQuery.Models 9 | { 10 | public class HomeViewModel 11 | { 12 | [Display(Name="Customer name")] 13 | public string SearchString { get; set; } 14 | [Display(Name="Directly seach table")] 15 | public bool UseTable { get; set; } 16 | [Display(Name = "Response time with cache")] 17 | [DisplayFormat(DataFormatString = "{0:N}")] 18 | public long CachedResponseTime { get; set; } 19 | [Display(Name="Response time without cache")] 20 | [DisplayFormat(DataFormatString = "{0:N}")] 21 | public long TableResponseTime { get; set; } 22 | public List MatchedCustomers { get; set; } 23 | public List MatchedProducts { get; set; } 24 | public List TableCustomers { get; set; } 25 | public string ProductCategory { get; set; } 26 | public List TableProducts { get; set; } 27 | public List ProductCategories { get; set; } 28 | public HomeViewModel() 29 | { 30 | MatchedCustomers = new List(); 31 | TableCustomers = new List(); 32 | MatchedProducts = new List(); 33 | TableProducts = new List(); 34 | ProductCategories = new List{ 35 | "Apparel", "Automotive", "Baby", "Beauty", "Books", "Classical", "DVD", 36 | "Electronics", "GourmetFood", "Grocery", "HealthPersonalCare", "HomeGarden", 37 | "Industrial", "Jewelry", "KindleStore", "Kitchen", "Magazines", "MP3Downloads", 38 | "Music", "MusicalInstruments", "OfficeProducts", "OutdoorLiving", "PCHardware", 39 | "PetSupplies", "Photo", "Shoes", "Software", "SportingGoods", "Tools", 40 | "Toys", "UnboxVideo", "VHS", "VideoGames", "Wireless", "WirelessAccessories"}; 41 | ProductCategory = ProductCategories.First(); 42 | } 43 | } 44 | public class Customer: TableEntity 45 | { 46 | public string Id { get; set; } 47 | public string Company { get; set; } 48 | public string Name { get; set; } 49 | [DisplayFormat(DataFormatString = "{0:C}")] 50 | public double Value { get; set; } 51 | public string Comment { get; set; } 52 | public DateTime ContractDate { get; set; } 53 | } 54 | public class Product: TableEntity 55 | { 56 | public string Id { get; set; } 57 | public string Name { get; set; } 58 | public string Manufactor { get; set; } 59 | public double Price { get; set; } 60 | public string Category { get; set; } 61 | public int Rate { get; set; } 62 | } 63 | } -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Project_Readme.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Your ASP.NET application 6 | 95 | 96 | 97 | 98 | 102 | 103 |
    104 |
    105 |

    This application consists of:

    106 |
      107 |
    • Sample pages showing basic nav between Home, About, and Contact
    • 108 |
    • Theming using Bootstrap
    • 109 |
    • Authentication, if selected, shows how to register and sign in
    • 110 |
    • ASP.NET features managed using NuGet
    • 111 |
    112 |
    113 | 114 | 131 | 132 |
    133 |

    Deploy

    134 | 139 |
    140 | 141 |
    142 |

    Get help

    143 | 147 |
    148 |
    149 | 150 | 151 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedisCacheCustomerQuerySample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedisCacheCustomerQuerySample")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b13ed835-4831-4905-9773-634a62572290")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/README.md: -------------------------------------------------------------------------------- 1 | Demo how Redis Cache can improve performance by Caching data 2 | ===================================================================== 3 | This sample shows how a Cache can make an app more performant since retreivals from Cache are much faster as compared to a persistent storage. 4 | 5 | ## Pre-req 6 | You should run the SeedCacheForCustomerQuerySample for seeding the Azure Storage and Caches. Use the same connectionstring that you used in the Seeding Sample 7 | 8 | ## How To Run This Sample 9 | You need the following information from Azure Portal 10 | .Use the same connectionstring that you used in the Seeding Sample 11 | - Create a Azure Storage Account. 12 | - Create two Caches. Read more how How-To here https://msdn.microsoft.com/en-us/library/dn690516.aspx 13 | - Copy the Storage Connection, Cache Name and Keys and set in App.config. You can also set it as AppSetting for your Azure Website 14 | - Enable Non-SSL port (6379) in your Cache settings 15 | - Run the app (Note this will override any existing data in your storage account/ Cache) 16 | 17 | ## Demoes 18 | - Search by Customer (Aaron) 19 | - Do autoComplete in the text box to get the Customername 20 | - Naviate to Product and browse by Category 21 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this);b.data("validator").resetForm();b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){return a(b.form).find(":input").filter("[name='"+f(c)+"']").val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 16 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 17 | window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); 18 | 19 | /*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ 20 | (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this); -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |

    Use this area to provide additional information.

    8 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

    @ViewBag.Title.

    5 |

    @ViewBag.Message

    6 | 7 |
    8 | One Microsoft Way
    9 | Redmond, WA 98052-6399
    10 | P: 11 | 425.555.0100 12 |
    13 | 14 |
    15 | Support: Support@example.com
    16 | Marketing: Marketing@example.com 17 |
    -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | @model CustomerQuery.Models.HomeViewModel 5 | @using (Html.BeginForm("SearchCustomers", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 6 | { 7 |
    8 |
    9 |
    10 |
    11 |

    Customer Search

    12 |
    13 |
    14 | 15 | 16 | 19 | 22 | 25 | 26 |
    17 | @Html.LabelFor(m => m.SearchString) 18 | 20 | @Html.TextBoxFor(m => m.SearchString, new { @id = "searchbox", @autocomplete = "off", @class = "form-control" }) 21 | 23 | 24 |
    27 | 28 | @Html.LabelFor(m => m.UseTable) 29 | @Html.CheckBoxFor(m => m.UseTable) 30 | 31 |
    32 |
    33 |
    34 |
    35 |
    36 |
    37 |
    38 |
    39 |

    Cached Access to Table Storage

    40 |
    41 |
    42 | @if (Model.MatchedCustomers.Count > 0) 43 | { 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | @foreach (var c in Model.MatchedCustomers) 53 | { 54 | 55 | 56 | 57 | 58 | } 59 | 60 |
    namebalance
    @c.Name$@c.Value
    61 | } 62 | else 63 | { 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
    namebalance
    No Records Found
    75 | } 76 |
    77 | 84 |
    85 |
    86 |
    87 |
    88 |
    89 |

    Direct Access to Table Storage

    90 |
    91 |
    92 | @if (Model.TableCustomers.Count > 0) 93 | { 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | @foreach (var c in Model.TableCustomers) 103 | { 104 | 105 | 106 | 107 | 108 | } 109 | 110 |
    namebalance
    @c.Name$@c.Value
    111 | } 112 | else 113 | { 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |
    namebalance
    No Records Found
    125 | } 126 |
    127 | 134 |
    135 |
    136 |
    137 | } 138 | 139 | 140 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | Error 10 | 11 | 12 |
    13 |

    Error.

    14 |

    An error occurred while processing your request.

    15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title - My ASP.NET Application 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 29 |
    30 | @RenderBody() 31 |
    32 |
    33 |

    © @DateTime.Now.Year - My ASP.NET Application

    34 |
    35 |
    36 | 37 | @Scripts.Render("~/bundles/jquery") 38 | @Scripts.Render("~/bundles/bootstrap") 39 | @RenderSection("scripts", required: false) 40 | 41 | 42 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/favicon.ico -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rustd/RedisSamples/f58de8a671ec51129cb7b38dc1eb11d665b62d6e/RedisCacheCustomerQuerySample/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /RedisCacheCustomerQuerySample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /RedisSamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{84A52844-AE32-4A0D-966C-D55FAF2534B0}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomMonitoring", "CustomMonitoring\CustomMonitoring.csproj", "{AE1C7F76-3B8B-4183-AB92-9D4045001F38}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionState_OutputCaching", "SessionState_OutputCaching\SessionState_OutputCaching.csproj", "{67C6D163-555B-4033-8D98-8708092AFC80}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisAsSignalRBackplane", "RedisAsSignalRBackplane\RedisAsSignalRBackplane.csproj", "{89D215AF-E97A-4789-AD8D-642275CFBD58}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeedCacheForCustomerQuerySample", "SeedCacheForCustomerQuerySample\SeedCacheForCustomerQuerySample.csproj", "{6CC975A5-B770-459F-B10E-2E06375B44FF}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisCacheCustomerQuerySample", "RedisCacheCustomerQuerySample\RedisCacheCustomerQuerySample.csproj", "{4A04426C-81E8-42BA-A80A-9F6D5E191CB1}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManageCacheUsingMAML", "ManageCacheUsingMAML\ManageCacheUsingMAML.csproj", "{8D12202E-EE12-45D8-883D-55865A6B0199}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Release|Any CPU = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {84A52844-AE32-4A0D-966C-D55FAF2534B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {84A52844-AE32-4A0D-966C-D55FAF2534B0}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {84A52844-AE32-4A0D-966C-D55FAF2534B0}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {84A52844-AE32-4A0D-966C-D55FAF2534B0}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {AE1C7F76-3B8B-4183-AB92-9D4045001F38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {AE1C7F76-3B8B-4183-AB92-9D4045001F38}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {AE1C7F76-3B8B-4183-AB92-9D4045001F38}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {AE1C7F76-3B8B-4183-AB92-9D4045001F38}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {67C6D163-555B-4033-8D98-8708092AFC80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {67C6D163-555B-4033-8D98-8708092AFC80}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {67C6D163-555B-4033-8D98-8708092AFC80}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {67C6D163-555B-4033-8D98-8708092AFC80}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {89D215AF-E97A-4789-AD8D-642275CFBD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {89D215AF-E97A-4789-AD8D-642275CFBD58}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {89D215AF-E97A-4789-AD8D-642275CFBD58}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {89D215AF-E97A-4789-AD8D-642275CFBD58}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {6CC975A5-B770-459F-B10E-2E06375B44FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {6CC975A5-B770-459F-B10E-2E06375B44FF}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {6CC975A5-B770-459F-B10E-2E06375B44FF}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {6CC975A5-B770-459F-B10E-2E06375B44FF}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {4A04426C-81E8-42BA-A80A-9F6D5E191CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {4A04426C-81E8-42BA-A80A-9F6D5E191CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {4A04426C-81E8-42BA-A80A-9F6D5E191CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {4A04426C-81E8-42BA-A80A-9F6D5E191CB1}.Release|Any CPU.Build.0 = Release|Any CPU 50 | {8D12202E-EE12-45D8-883D-55865A6B0199}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {8D12202E-EE12-45D8-883D-55865A6B0199}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {8D12202E-EE12-45D8-883D-55865A6B0199}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {8D12202E-EE12-45D8-883D-55865A6B0199}.Release|Any CPU.Build.0 = Release|Any CPU 54 | EndGlobalSection 55 | GlobalSection(SolutionProperties) = preSolution 56 | HideSolutionNode = FALSE 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/CSV_Database_of_Categories.csv: -------------------------------------------------------------------------------- 1 | Apparel 2 | Automotive 3 | Baby 4 | Beauty 5 | Books 6 | Classical 7 | DVD 8 | Electronics 9 | GourmetFood 10 | Grocery 11 | HealthPersonalCare 12 | HomeGarden 13 | Industrial 14 | Jewelry 15 | KindleStore 16 | Kitchen 17 | Magazines 18 | MP3Downloads 19 | Music 20 | MusicalInstruments 21 | OfficeProducts 22 | OutdoorLiving 23 | PCHardware 24 | PetSupplies 25 | Photo 26 | Shoes 27 | Software 28 | SportingGoods 29 | Tools 30 | Toys 31 | UnboxVideo 32 | VHS 33 | VideoGames 34 | Wireless 35 | WirelessAccessories -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SeedCacheForCustomerQuerySample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SeedCacheForCustomerQuerySample")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7c08728c-98c4-45ec-bd43-924edfd3b76a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/README.md: -------------------------------------------------------------------------------- 1 | Seed the Database and Cache for the demo 2 | ========================================================= 3 | This sample will seed the Azure Storage account and populate 2 caches with the data. 4 | This data is used in the RedisCacheCustomerQuerySample sample. 5 | 6 | ## How To Run This Sample 7 | You need the following information from Azure Portal 8 | 9 | - Create a Storage Account and set the connection in app.config 10 | - Create 2 caches as shown http://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/ 11 | - Copy the Cache Name and Keys and set them in app.config 12 | - Run the app. Note this will delete any existing data in the Cache 13 | -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/SeedCacheForCustomerQuerySample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6CC975A5-B770-459F-B10E-2E06375B44FF} 8 | Exe 9 | Properties 10 | SeedCacheForCustomerQuerySample 11 | SeedCacheForCustomerQuerySample 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | False 37 | ..\packages\BookSleeve.1.3.41\lib\BookSleeve.dll 38 | 39 | 40 | ..\packages\Microsoft.Data.Edm.5.6.2\lib\net40\Microsoft.Data.Edm.dll 41 | 42 | 43 | ..\packages\Microsoft.Data.OData.5.6.2\lib\net40\Microsoft.Data.OData.dll 44 | 45 | 46 | ..\packages\Microsoft.Data.Services.Client.5.6.2\lib\net40\Microsoft.Data.Services.Client.dll 47 | 48 | 49 | ..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll 50 | 51 | 52 | ..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll 53 | 54 | 55 | ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll 56 | 57 | 58 | ..\packages\StackExchange.Redis.1.1.603\lib\net45\StackExchange.Redis.dll 59 | True 60 | 61 | 62 | 63 | 64 | 65 | ..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Always 81 | 82 | 83 | Always 84 | 85 | 86 | Always 87 | 88 | 89 | Always 90 | 91 | 92 | 93 | 94 | 101 | -------------------------------------------------------------------------------- /SeedCacheForCustomerQuerySample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SessionState_OutputCaching.Default" %> 2 | <%@ OutputCache Duration="100" VaryByParam="*" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    13 |

    14 | Please set the redis host name and accesskey in web.config 15 |

    19 | 20 |

    21 | This value is from Redis SessionState Provider <%= Session["redis"] %> 22 |
    23 |
    24 | 25 | 26 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace SessionState_OutputCaching 9 | { 10 | public partial class Default : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | Session["redis"] = DateTime.Now.ToString(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SessionState_OutputCaching/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace SessionState_OutputCaching 11 | { 12 | 13 | 14 | public partial class Default 15 | { 16 | 17 | /// 18 | /// form1 control. 19 | /// 20 | /// 21 | /// Auto-generated field. 22 | /// To modify move field declaration from designer file to code-behind file. 23 | /// 24 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SessionState_OutputCaching")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SessionState_OutputCaching")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("df10abd1-8602-4f6f-8c2c-277d39d5acff")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/README.md: -------------------------------------------------------------------------------- 1 | Use Azure Redis Cache to store ASP.NET SessionState and OutputCache 2 | ============================================================== 3 | This sample demonstrates how you to use Azure Redis Cache to store ASP.NET Session and Output Cache. This app uses the SessionState and OutputCache providers for Redis. 4 | 5 | ## How To Run This Sample 6 | 7 | 8 | You need the following information from Azure Portal 9 | .Use the same connectionstring that you used in the Seeding Sample 10 | - Create a Cache. Read more how How-To here https://msdn.microsoft.com/en-us/library/dn690516.aspx 11 | - Copy Cache Name and Keys and set in web.config in the providers section for Session & OutputCache. 12 | - Run the app 13 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/SessionState_OutputCaching.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {67C6D163-555B-4033-8D98-8708092AFC80} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | SessionState_OutputCaching 15 | SessionState_OutputCaching 16 | v4.5 17 | true 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | true 26 | full 27 | false 28 | bin\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | pdbonly 35 | true 36 | bin\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | 43 | 44 | ..\packages\Microsoft.Web.RedisOutputCacheProvider.1.4.0\lib\net40\Microsoft.Web.RedisOutputCacheProvider.dll 45 | 46 | 47 | ..\packages\Microsoft.Web.RedisSessionStateProvider.1.5.0\lib\net40\Microsoft.Web.RedisSessionStateProvider.dll 48 | 49 | 50 | ..\packages\StackExchange.Redis.StrongName.1.1.603\lib\net45\StackExchange.Redis.StrongName.dll 51 | True 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Web.config 74 | 75 | 76 | Web.config 77 | 78 | 79 | 80 | 81 | 82 | Designer 83 | 84 | 85 | 86 | 87 | Default.aspx 88 | ASPXCodeBehind 89 | 90 | 91 | Default.aspx 92 | 93 | 94 | 95 | 96 | 10.0 97 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | True 107 | True 108 | 49032 109 | / 110 | http://localhost:49032/ 111 | False 112 | False 113 | 114 | 115 | False 116 | 117 | 118 | 119 | 120 | 127 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /SessionState_OutputCaching/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | --------------------------------------------------------------------------------