This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<sessionState mode="Custom" customProvider="MySessionStateStore"> | |
<providers> | |
<add name="MySessionStateStore" | |
host = "127.0.0.1" [String] | |
port = "" [number] | |
accessKey = "" [String] | |
ssl = "false" [true|false] | |
throwOnError = "true" [true|false] | |
retryTimeoutInMilliseconds = "0" [number] | |
databaseId = "0" [number] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cache.StringSet("key1", "value1", TimeSpan.FromMinutes(90)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDatabase cache = Connection.GetDatabase(); | |
// Perform cache operations using the cache object... | |
// Simple put of integral data types into the cache | |
cache.StringSet("key1", "value"); | |
cache.StringSet("key2", 25); | |
// Simple get of data types from the cache | |
string key1 = cache.StringGet("key1"); | |
int key2 = (int)cache.StringGet("key2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("contoso5.redis.cache.windows.net,ssl=true,password=..."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StackExchange.Redis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void InitializeContainer(Container container) | |
{ | |
// Register ConsoleLogger as a singleton | |
container.RegisterSingle<ILogger, ConsoleLogger>(); | |
// container.Register<ILogger, ConsoleLogger>(Lifestyle.Singleton); | |
container.Register<ICounter, Counter>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Interfaces; | |
using System; | |
namespace Common | |
{ | |
public class ConsoleLogger : ILogger | |
{ | |
public void LogMessage(string message) | |
{ | |
Console.WriteLine(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Http; | |
using SimpleInjector; | |
using SimpleInjector.Integration.WebApi; | |
using Interfaces; | |
using Common; | |
public static class SimpleInjectorWebApiInitializer | |
{ | |
// Make container available to the rest of the application | |
// Use Container to instantiate the objects you want |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public interface IService | |
{ | |
void Serve(); | |
} | |
public class Service : IService | |
{ | |
public void Serve() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public interface IService | |
{ | |
void Serve(); | |
} | |
public class Service : IService | |
{ | |
public void Serve() |