{"id":5991,"date":"2014-06-05T00:00:00","date_gmt":"2014-06-05T00:00:00","guid":{"rendered":"https:\/\/azure.microsoft.com\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes"},"modified":"2024-07-24T09:20:21","modified_gmt":"2024-07-24T16:20:21","slug":"mvc-movie-app-with-azure-redis-cache-in-15-minutes","status":"publish","type":"post","link":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/","title":{"rendered":"MVC movie app with Azure Redis Cache in 15 minutes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The new <a href=\"https:\/\/azuremicrosoftcom\/en-us\/documentation\/services\/cache\/\" target=\"_blank\" rel=\"noreferrer noopener\">Azure Redis Cache<\/a> is really easy to plug into your Azure web app I had it plugged into my <a href=\"https:\/\/wwwaspnet\/mvc\/tutorials\/mvc-5\/introduction\/getting-started\">MVC Movie sample app<\/a>, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally)<\/p>\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp\" alt=\"graphical user interface\" class=\"wp-image-8621 webp-format\" data-orig-src=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp\"><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The cache is about 100 times faster than banging on a database By fetching hot data from the cache, you not only speed up your app but you can reduce the DB load and increase its responsiveness for other queries. You can download my completed sample here. This is what I did to plug the Redis cache into my MVC movie sample:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">Log on to the <a href=\"https:\/\/portalazurecom\/\" target=\"_blank\" rel=\"noreferrer noopener\">Azure\u00a0 portal<\/a> and select create a new cache<br>This step can take up to 15 minutes, but I\u2019m not counting that in my time For complete instructions see <a href=\"https:\/\/azuremicrosoftcom\/en-us\/documentation\/articles\/cache-dotnet-how-to-use-azure-redis-cache\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Use Azure Redis Cache<\/a>\u00a0 It\u2019s critical you create the cache is the same location (data center) that you create your web site I tested this by moving my web site to a different location, and cache latency increased by a factor of 25 For detailed instructions see <a href=\"https:\/\/msdnmicrosoftcom\/en-us\/library\/dn690516aspx\" target=\"_blank\" rel=\"noreferrer noopener\">Create a Redis Cache<\/a> You can download my MvcMovie as a starter sample Alternatively, you can download my completed sample and update the cache endpoint ( URL ) and credentials, then follow along<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Copy the cache name rediscachewindowsnet and the password (hit the <strong>keys<\/strong> button in the properties blade of the portal to see the cache name and password)<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Add the NuGet package <strong>StackExchangeRedis<\/strong> You\u2019ll also need to restore the NuGet packages in my sample if you\u2019re using that<\/li>\n\n\n\n<li class=\"wp-block-list-item\">From the package manager console, run <strong>Update-Database<\/strong> You might have to exit and restart Visual Studio after restoring NuGet packages to see the <strong>Update-Database<\/strong> command<\/li>\n\n\n\n<li class=\"wp-block-list-item\">Plug the connection info into your controller:<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\npublic class MoviesController : Controller\n{\n   private MovieDBContext db = new MovieDBContext();\n   private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>\n   {\n      return ConnectionMultiplexerConnect(KeysconStr);\n   });\n\n   public static ConnectionMultiplexer Connection\n   {\n      get\n      {\n         return lazyConnectionValue;\n      }\n   }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Warning<\/strong>: Never store credentials is source code To keep this sample simple, I\u2019m showing them in the source code See <a href=\"https:\/\/azuremicrosoftcom\/blog\/2013\/07\/17\/windows-azure-web-sites-how-application-strings-and-connection-strings-work\/\">Windows Azure Web Sites: How Application Strings and Connection Strings Work<\/a> for information on how to store credentials. Note that the connection is stored as a static variable so you don\u2019t have to create a new connection on each request A get method is used so you can check that the connection is valid, and if the connection has been dropped, the connection is reestablished.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a new class containing the <strong>SampleStackExchangeRedisExtensions<\/strong> class:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\npublic static class SampleStackExchangeRedisExtensions\n{\n   public static T Get<T>(this IDatabase cache, string key)\n   {\n      return Deserialize<T>(cacheStringGet(key));\n   }\n\n   public static object Get(this IDatabase cache, string key)\n   {\n      return Deserialize<object>(cacheStringGet(key));\n   }\n\n   public static void Set(this IDatabase cache, string key, object value)\n   {\n      cacheStringSet(key, Serialize(value));\n   }\n\n   static byte[] Serialize(object o)\n   {\n      if (o == null)\n      {\n         return null;\n      }\n      BinaryFormatter binaryFormatter = new BinaryFormatter();\n      using (MemoryStream memoryStream = new MemoryStream())\n      {\n         binaryFormatterSerialize(memoryStream, o);\n         byte[] objectDataAsStream = memoryStreamToArray();\n         return objectDataAsStream;\n      }\n   }\n\n   static T Deserialize<T>(byte[] stream)\n   {\n      BinaryFormatter binaryFormatter = new BinaryFormatter();\n      if (stream == null)\n         return default(T);\n\n      using (MemoryStream memoryStream = new MemoryStream(stream))\n      {\n         T result = (T)binaryFormatterDeserialize(memoryStream);\n         return result;\n      }\n   }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The\u00a0<strong>SampleStackExchangeRedisExtensions<\/strong>\u00a0class makes it easy to cache any serializable type.\u00a0You\u2019ll need to add the\u00a0<a href=\"https:\/\/msdnmicrosoftcom\/en-us\/library\/systemserializableattribute.aspx\">[Serializable]<\/a>\u00a0attribute to your model.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n[Serializable]\npublic class Movie\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Find all the instances of\u00a0\u00a0Movie\u00a0movie = dbMoviesFind(id);\u00a0and replace them with:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n\/\/Movie movie = dbMoviesFind(id);\nMovie movie = getMovie((int)id);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In the POST Edit and Delete methods, evict the cache with the following call:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\nClearMovieCache(movieID);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Add the following code to the movie controller The\u00a0<strong>getMovie<\/strong>\u00a0method uses the standard on demand cache aside approach:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\nMovie getMovie(int id)\n{\n   Stopwatch sw = StopwatchStartNew();\n   IDatabase cache = ConnectionGetDatabase();\n   Movie m = (Movie)cacheGet(idToString()); \n\n   if (m == null)\n   {\n      Movie movie = dbMoviesFind(id);\n      cacheSet(idToString(), movie);\n      StopWatchMiss(sw);\n      return movie;\n   }\n   StopWatchHit(sw); \n\n   return m;\n} \n\nprivate void ClearMovieCache(int p)\n{\n   IDatabase cache = connectionGetDatabase();\n   if (cacheKeyExists(pToString()))\n      cacheKeyDelete(pToString());\n} \n\nvoid StopWatchEnd(Stopwatch sw, string msg)\n{\n   swStop();\n   double ms = swElapsedTicks \/ (StopwatchFrequency \/ (10000));\n   ViewBagcacheMsg = msg + msToString() +\n       \ufffd? PID: \ufffd? + ProcessGetCurrentProcess()IdToString();\n} \n\nvoid StopWatchMiss(Stopwatch sw)\n{\n   StopWatchEnd(sw, \u201cMiss \u2013 MS:\ufffd?);\n} \n\nvoid StopWatchHit(Stopwatch sw)\n{\n   StopWatchEnd(sw, \u201cHit \u2013 MS:\ufffd?);\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Add the\u00a0<strong>ViewBagcacheMsg<\/strong>\u00a0code to the\u00a0<em>Views\\Shared\\_Layoutcshtml\u00a0<\/em>file so you get timing information on every page:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n<div class=\"container body-content\">\n        @RenderBody()\n        <hr \/>\n        <footer>\n           <h2>@ViewBagcacheMsg<\/h2>\n        <\/footer>\n    <\/div>\n\n    @ScriptsRender(\"~\/bundles\/jquery\")\n    @ScriptsRender(\"~\/bundles\/bootstrap\")\n    @RenderSection(\"scripts\", required: false)\n<\/body>\n<\/html>\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You can now test locally and get timing information Once a movie is cached, it stays cached (my DB is too small to every evict data because of memory pressure) Performance from your desktop to the cloud cache won\u2019t be great On the sample download, you can click the\u00a0<strong>ClearCache<\/strong>\u00a0button to evict each cache entry.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"monitoring-the-cache-from-the-portal\">Monitoring the cache from the portal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">From the portal you can get cache hit\/miss statistics. You can only set alerts on items you check above. Double click the Add Alert button and you can set up alerts for any item you\u2019re monitoring In the image below; I\u2019m monitoring key evictions over a 15 minute period. A high rate of eviction indicates you\u2019ll probably benefit from a bigger cache. Visual Studio makes it easy to publish to Azure. Right click the web app and select publish. It\u2019s critical you select the same web site region where you created the cache latency is much higher as you would expect. A cache located in a different region than you cache clients (in this case a web app) can also incur data transfer costs. On the settings tab make sure you check <strong>Execute Code First Migrations<\/strong>. You can now test the app in the cloud and have much lower cache latency (assuming your cache and web site are in the same data center).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"stress-testing-the-cache\">Stress testing the cache<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The default time out for cache operations is 1000 MS (one second) You can use the following code to inc your code is correctly handling time out exceptions When <strong>#define NotTestingTimeOut<\/strong> is commented out, the timeout is lowered to 150 MS to make it easier to hit timeout exceptions under high load.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n#else\n   #region StressTest\n       private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>\n      {\n\n      var config = new ConfigurationOptions();\n            configEndPointsAdd(KeysURL);\n            configPassword = Keyspasswd;\n            configSsl = true;\n            configSyncTimeout = 150;\n\n           return ConnectionMultiplexerConnect(config);\n      });\n   #endregion\n#endif\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I recommend you disable session cache while stress testing You can do for the entire app with the flowing element in the\u00a0<em>webconfig<\/em>\u00a0file<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n<sessionState mode=\"Off\" \/>\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Or you can use\u00a0<a href=\"https:\/\/msdnmicrosoftcom\/en-us\/library\/systemwebmvcsessionstateattribute.aspx\" target=\"_blank\" rel=\"noreferrer noopener\">[SessionState(SessionStateBehaviorDisabled)]<\/a>\u00a0on your controller The updated\u00a0getMovie\u00a0method is more robust and will retry up to 3 times with time out exceptions:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n      Movie getMovie(int id, int retryAttempts = 0)\n      {\n         IDatabase cache = ConnectionGetDatabase();\n         if (retryAttempts > 3)\n         {\n            string error = \"getMovie timeout with \" + retryAttemptsToString()\n               + \" retry attempts Movie ID = \" + idToString();\n            Logger(error);\n\n            ViewBagcacheMsg = error + \" Fetch from DB\";\n            \/\/ Cache unavailable, get data from DB\n            return dbMoviesFind(id);\n         }\n         Stopwatch sw = StopwatchStartNew();\n         Movie m;\n\n         try\n         {\n            m = (Movie)cacheGet(idToString());\n         }\n\n         catch (TimeoutException tx)\n         {\n            Logger(\"getMovie fail, ID = \" + idToString(), tx);\n            return getMovie(id, ++retryAttempts);\n         }\n\n         if (m == null)\n         {\n            Movie movie = dbMoviesFind(id);\n            cacheSet(idToString(), movie);\n            StopWatchMiss(sw);\n            return movie;\n         }\n         StopWatchHit(sw);\n\n         return m;\n      }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The sample app has several methods you can call to load test the cache. The WriteCache and ReadCache methods write or read 1 K items. You can optionally append \u201c\/n\ufffd? to the URL to write or read n*K items. For example, https:\/\/azurewebsitesnet\/Movies\/ReadCache\/3 will read 3K cached items. With a 150 MS time-out and hitting the cache hard, I was able to get about style=&#8221;background: white;color: black&#8221;>getMovie method correctly handles cache failures and returns the movie from the DB then writes a warning message to the log \u201cgetMovie timeout with 4 retry attempts Movie ID = 3 Fetch from DB\ufffd? Production apps should be ready to handle cache failures If you\u2019ve selected the basic cache (which doesn\u2019t have a slave or failover), you\u2019re guaranteed the cache will be unavailable for several minutes once a month while the hosting VM is patched. While a standard cache has a master and slave (that is a failover cache) that has a very fast non-blocking first synchronization and auto-reconnection, you should write your code to correctly handle a cache failure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"azure-redis-cache-aspnet-session-state-provider\">Azure Redis Cache ASPNET Session State Provider<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">While it\u2019s considered a best practice is to avoid using session state, some applications can actually have a <strong>performance\/complexity benefit<\/strong> from using session data, while other apps outright require session state The default in memory provider for session state does not allow scale out (running multiple instances of the web site) The ASPNET SQL Server session state provider will allow multiple web sites to use session state, but it incurs a high latency cost compared to an in memory provider The Redis session state cache provider is a low latency alternative that is very easy to configure and set up If your app uses only a limited amount of session state, you can use most of the cache for caching data and a small amount for session state Add the <strong>RedisSessionStateProvider<\/strong> NuGet package to your web app (Specify prerelease See this article for full instructions) Edit the markup added to your root Webconfig file with your host URL and keys Be sure to set SSL to true:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n <systemweb>\n     <customErrors mode=\"Off\" \/>\n     <!--<sessionState mode=\"Off\" \/>-->\n    <authentication mode=\"None\" \/>\n    <compilation debug=\"true\" targetFramework=\"45\" \/>\n    <httpRuntime targetFramework=\"45\" \/>\n  <sessionState mode=\"Custom\" customProvider=\"RedisSessionProvider\">\n               <add name=\"RedisSessionProvider\" \n              type=\"MicrosoftWebRedisRedisSessionStateProvider\" \n              port=\"6380\"\n              host=\"movie2rediscachewindowsnet\" \n              accessKey=\"m7PNV60CrvKpLqMUxosC3dSe6kx9nQ6jP5del8TmADk=\" \n              ssl=\"true\" \/>\n      <!--<add name=\"MySessionStateStore\" type=\"MicrosoftWebRedisRedisSessionStateProvider\" host=\"127001\" accessKey=\"\" ssl=\"false\" \/>-->\n      <\/providers>\n    <\/sessionState>\n  <\/systemweb>\n  <systemwebServer>\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You can now use session state in your web app. The sample provides the WriteCache and ReadCache action menu\u2019s (and UI). The Write cache allows the option of providing string route data, for example:\u00a0<em>https:\/\/&lt;your site>azurewebsitesnet\/SessionTest\/WriteSession\/Hello_joe<\/em>\u00a0will write \u201cHello_joe\ufffd? to session state. All your instances of the app will use the same Redis session cache, so you won\u2019t have to use sticky sessions. Let me know how you like this topic and what you\u2019d like me to cover next on the Redis cache. Follow me (<a href=\"https:\/\/twitter.com\/RickAndMSFT\">@RickAndMSFT<\/a>)\u00a0on twitter where I have a no spam guarantee of quality tweets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"additional-resources\">Additional resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/msdnmicrosoftcom\/en-us\/library\/dn690521.aspx\" target=\"_blank\" rel=\"noreferrer noopener\">Caching data in Azure Redis Cache<\/a><\/li>\n\n\n\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/wacelcodeplex.com\/\">Windows Azure Cache Extension Library<\/a>\u00a0WACEL provides an implementation of high-level data structures that can be shared among your services and application<\/li>\n\n\n\n<li class=\"wp-block-list-item\"><a href=\"https:\/\/msdnmicrosoftcom\/en-us\/library\/dn690523.aspx\">MSDN Azure Redis Cache<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ms_queue_id":[],"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","footnotes":"","msx_community_cta_settings":[]},"categories":[1473],"tags":[],"audience":[],"content-type":[1511],"product":[2912],"tech-community":[],"topic":[],"coauthors":[1426],"class_list":["post-5991","post","type-post","status-publish","format-standard","hentry","category-databases","content-type-best-practices","product-azure-cache-for-redis","review-flag-1680286581-295","review-flag-1680286581-364","review-flag-1-1680286581-825","review-flag-3-1680286581-173","review-flag-4-1680286581-250","review-flag-bundl-1680286579-710","review-flag-disable","review-flag-never-1680286580-606","review-flag-new-1680286579-546","review-flag-vm-1680286585-143"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog<\/title>\n<meta name=\"description\" content=\"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog\" \/>\n<meta property=\"og:description\" content=\"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Azure Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/microsoftazure\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-05T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-24T16:20:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png\" \/>\n<meta name=\"author\" content=\"Rick Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@azure\" \/>\n<meta name=\"twitter:site\" content=\"@azure\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\"},\"author\":[{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/rick-anderson\/\",\"@type\":\"Person\",\"@name\":\"Rick Anderson\"}],\"headline\":\"MVC movie app with Azure Redis Cache in 15 minutes\",\"datePublished\":\"2014-06-05T00:00:00+00:00\",\"dateModified\":\"2024-07-24T16:20:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\"},\"wordCount\":1316,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png\",\"articleSection\":[\"Databases\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\",\"name\":\"MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog\",\"isPartOf\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png\",\"datePublished\":\"2014-06-05T00:00:00+00:00\",\"dateModified\":\"2024-07-24T16:20:21+00:00\",\"description\":\"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).\",\"breadcrumb\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp\",\"contentUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp\",\"width\":493,\"height\":525,\"caption\":\"graphical user interface\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog home\",\"item\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Databases\",\"item\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/category\/databases\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MVC movie app with Azure Redis Cache in 15 minutes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#website\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\",\"name\":\"Microsoft Azure Blog\",\"description\":\"Get the latest Azure news, updates, and announcements from the Azure blog. From product updates to hot topics, hear from the Azure experts.\",\"publisher\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\",\"name\":\"Microsoft Azure Blog\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp\",\"contentUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp\",\"width\":512,\"height\":512,\"caption\":\"Microsoft Azure Blog\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/microsoftazure\",\"https:\/\/x.com\/azure\",\"https:\/\/www.instagram.com\/microsoftdeveloper\/\",\"https:\/\/www.linkedin.com\/company\/16188386\",\"https:\/\/www.youtube.com\/user\/windowsazure\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/person\/c702e5edd662b328b49b7e1180cab117\",\"name\":\"shakir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g7664e653ea371ce16eaf75e9fa8952c4\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g\",\"caption\":\"shakir\"},\"sameAs\":[\"https:\/\/azure.microsoft.com\"],\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/shakir\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog","description":"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/","og_locale":"en_US","og_type":"article","og_title":"MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog","og_description":"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).","og_url":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/","og_site_name":"Microsoft Azure Blog","article_publisher":"https:\/\/www.facebook.com\/microsoftazure","article_published_time":"2014-06-05T00:00:00+00:00","article_modified_time":"2024-07-24T16:20:21+00:00","og_image":[{"url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png","type":"","width":"","height":""}],"author":"Rick Anderson","twitter_card":"summary_large_image","twitter_creator":"@azure","twitter_site":"@azure","twitter_misc":{"Written by":"Rick Anderson","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#article","isPartOf":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/"},"author":[{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/rick-anderson\/","@type":"Person","@name":"Rick Anderson"}],"headline":"MVC movie app with Azure Redis Cache in 15 minutes","datePublished":"2014-06-05T00:00:00+00:00","dateModified":"2024-07-24T16:20:21+00:00","mainEntityOfPage":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/"},"wordCount":1316,"commentCount":0,"publisher":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage"},"thumbnailUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png","articleSection":["Databases"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/","name":"MVC movie app with Azure Redis Cache in 15 minutes | Microsoft Azure Blog","isPartOf":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage"},"thumbnailUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.png","datePublished":"2014-06-05T00:00:00+00:00","dateModified":"2024-07-24T16:20:21+00:00","description":"The new preview Azure Redis Cache is really easy to plug into your Azure web app. I had it plugged into my MVC Movie sample app, deployed to Azure and running in under 17 minutes (15 minutes to plug it in and test locally).","breadcrumb":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#primaryimage","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp","contentUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2014\/06\/p1_thumb.webp","width":493,"height":525,"caption":"graphical user interface"},{"@type":"BreadcrumbList","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/mvc-movie-app-with-azure-redis-cache-in-15-minutes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog home","item":"https:\/\/azure.microsoft.com\/en-us\/blog\/"},{"@type":"ListItem","position":2,"name":"Databases","item":"https:\/\/azure.microsoft.com\/en-us\/blog\/category\/databases\/"},{"@type":"ListItem","position":3,"name":"MVC movie app with Azure Redis Cache in 15 minutes"}]},{"@type":"WebSite","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#website","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/","name":"Microsoft Azure Blog","description":"Get the latest Azure news, updates, and announcements from the Azure blog. From product updates to hot topics, hear from the Azure experts.","publisher":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/azure.microsoft.com\/en-us\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization","name":"Microsoft Azure Blog","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp","contentUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp","width":512,"height":512,"caption":"Microsoft Azure Blog"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/microsoftazure","https:\/\/x.com\/azure","https:\/\/www.instagram.com\/microsoftdeveloper\/","https:\/\/www.linkedin.com\/company\/16188386","https:\/\/www.youtube.com\/user\/windowsazure"]},{"@type":"Person","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/person\/c702e5edd662b328b49b7e1180cab117","name":"shakir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g7664e653ea371ce16eaf75e9fa8952c4","url":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g","caption":"shakir"},"sameAs":["https:\/\/azure.microsoft.com"],"url":"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/shakir\/"}]}},"msxcm_display_generated_audio":false,"msxcm_animated_featured_image":null,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Azure Blog","distributor_original_site_url":"https:\/\/azure.microsoft.com\/en-us\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts\/5991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/comments?post=5991"}],"version-history":[{"count":0,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts\/5991\/revisions"}],"wp:attachment":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/media?parent=5991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/categories?post=5991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/tags?post=5991"},{"taxonomy":"audience","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/audience?post=5991"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/content-type?post=5991"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/product?post=5991"},{"taxonomy":"tech-community","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/tech-community?post=5991"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/topic?post=5991"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/coauthors?post=5991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}