Microsoft has released a preview Redis Cache for Azure, along with an ASP.NET Session State Provider for Redis that can be used with standard Redis servers or with the Azure Redis Cache.
Redis is an open source, BSD licensed, advanced key-value store where the keys can contain strings, hashes, lists, sets and sorted sets. It’s increasing in popularity for web development as a session state store because of its simplicity and rich data structure support. An updated version of Redis was released in April with new features including a new data structure and extra commands for sorted data sets.
The Azure Redis Cache Service provides a secure, dedicated Redis cache, managed by Microsoft. The preview is being offered in two tiers, a single Cache node for development, testing and non-critical workloads, and a replicated Cache consisting of two nodes, a Master and a Slave. During the preview period, the Azure Redis Cache will be available in a 250 MB and 1 GB size. For a limited time, the cache will be offered free, with a limit of two caches per subscription.
Writing about the preview on his blog, Scott Guthrie shows how to use a .NET Redis client called StackExchange.Redis to connect to the cache endpoint. You can open any Visual Studio project and add the StackExchange.Redis NuGet package to it, via the NuGet package manager.
The preview of the ASP.NET session state provider for Redis is available using NuGet. Writing on the .NET Web Development and Tools Blog, Guang Yang says that while the Redis project doesn’t directly support Windows, Microsoft Open Technologies develops and maintains a high quality Windows port of Redis.
Yang explains that the Azure Redis Cache provides a session state provider that you can use to store your session state in a cache rather than in-memory or in a SQL Server database. To use the caching session state provider, you first configure your cache, and then configure your ASP.NET application for cache using the Redis Cache Session State NuGet package.
The session state provider saves a single session into Redis as a single hash.
For example, if you have a session with the session id = "session-id-1", and you’ve stored "key1 = val1" and "key2=val2" inside the session, then a request for HGETALL session-id-1_Data will return both the keys and values.
Yang says that when Microsoft talks to developers about the current available ASP.NET session state providers, one of the top complaints is that with the current available session state providers, if an error occurs during a session operation, the session state provider will throw an exception, which will blow up the entire application. He says “We want to address this in a way that it won’t surprise existing ASP.NET session state provider users and at the same time, provide the ability to opt-in the advanced behaviors.”
To do this, Microsoft has introduced a setting in the new session state provider, throwOnError. This lets you set whether or not to throw an exception when some error occurs. The default is true, which is consistent with the other ASP.NET session state providers Microsoft provides so existing code will just work. However, if you set throwOnError to false, then instead of throwing an exception when some error occurs, it will fail silently. You can then use error checking using a LastException property to handle exceptions more specifically.
The first version of the Hollerith Electronic Computer, Britain’s first mass-produced business computer which is notable for being based on a design by Andrew Booth and featuring his magnetic d [ ... ]