本文整理汇总了C#中IRedisClientsManager类的典型用法代码示例。如果您正苦于以下问题:C# IRedisClientsManager类的具体用法?C# IRedisClientsManager怎么用?C# IRedisClientsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRedisClientsManager类属于命名空间,在下文中一共展示了IRedisClientsManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RedisErrorLoggerFeature
public RedisErrorLoggerFeature(IRedisClientsManager redisManager)
{
if (redisManager == null)
throw new ArgumentNullException("redisManager");
this.redisManager = redisManager;
}
示例2: RedisMessageHandlerWorker
public RedisMessageHandlerWorker(
IRedisClientsManager clientsManager, IMessageHandler messageHandler, string queueName,
Action<IMessageHandlerBackgroundWorker, Exception> errorHandler)
: base(messageHandler, queueName, errorHandler)
{
this.clientsManager = clientsManager;
}
示例3: RedisQueue
public RedisQueue(
ISerializer serializer,
IRedisClientsManager clientManager,
IQueueKeyNameProvider keyNameProvider
)
: this(serializer, clientManager, keyNameProvider, 60)
{ }
示例4: RepositoryProxy
public RepositoryProxy(IDbConnectionFactory dbConnectionFactory, IRedisClientsManager redisClientsManager)
{
DbConnectionFactory= dbConnectionFactory;
RedisClientsManager= redisClientsManager;
CreateCommand();
CreateRedisClient();
}
示例5: UseClient
private static void UseClient(IRedisClientsManager manager, int clientNo)
{
var cacheManager = (IRedisClientCacheManager)manager;
var host = "";
try
{
using (var client = cacheManager.GetReadOnlyCacheClient())
{
host = ((IRedisClient)client).Host;
Log("Client '{0}' is using '{1}'", clientNo, host);
var testClientKey = "test:" + host + ":" + clientNo;
client.Set(testClientKey, testData);
var result = client.Get<string>(testClientKey) ?? "";
Log("\t{0} => {1} len {2} {3} len", testClientKey,
testData.Length, testData.Length == result.Length ? "==" : "!=", result.Length);
}
}
catch (NullReferenceException ex)
{
Log("NullReferenceException StackTrace: \n" + ex.StackTrace);
}
catch (Exception ex)
{
Log("\t[[email protected]{0}]: {1} => {2}",
host, ex.GetType().Name, ex.Message);
}
}
开发者ID:nuxleus,项目名称:ServiceStack.Redis,代码行数:31,代码来源:MultiThreadedCacheClientManagerIntegrationTests.cs
示例6: RedisTransientMessageFactory
public RedisTransientMessageFactory(int retryAttempts, TimeSpan? requestTimeOut,
IRedisClientsManager clientsManager)
{
this.ClientsManager = clientsManager ?? new BasicRedisClientManager();
MessageService = new RedisTransientMessageService(
retryAttempts, requestTimeOut, this);
}
示例7: UseClientAsync
private static void UseClientAsync(IRedisClientsManager manager, int clientNo)
{
using (var client = manager.GetReadOnlyClient())
{
UseClient(client, clientNo);
}
}
示例8: RedisCache
public RedisCache(string regionName, IDictionary<string, string> properties, RedisCacheElement element, IRedisClientsManager clientManager)
{
this.serializer = new ObjectSerializer();
this.clientManager = clientManager.ThrowIfNull("clientManager");
RegionName = regionName.ThrowIfNull("regionName");
expirySeconds = element != null
? (int)element.Expiration.TotalSeconds
: PropertiesHelper.GetInt32(NHibernate.Cfg.Environment.CacheDefaultExpiration, properties, DefaultExpiry);
log.DebugFormat("using expiration : {0} seconds", expirySeconds);
var regionPrefix = PropertiesHelper.GetString(NHibernate.Cfg.Environment.CacheRegionPrefix, properties, null);
log.DebugFormat("using region prefix : {0}", regionPrefix);
CacheNamePrefix = element != null ? element.CachePrefix : string.Empty;
var namespacePrefix = CacheNamePrefix + RegionName;
if (!String.IsNullOrWhiteSpace(regionPrefix))
{
namespacePrefix = regionPrefix + ":" + namespacePrefix;
}
CacheNamespace = new RedisNamespace(namespacePrefix);
SyncGeneration();
}
示例9: RegisterLuaScript
public static string RegisterLuaScript(IRedisClientsManager clientManager)
{
using (var client = clientManager.GetClient())
{
string scriptSha1 = client.LoadLuaScript(GetLuaScript());
return scriptSha1;
}
}
示例10: RedisQueueHandlerWorker
private readonly IRedisClientsManager clientsManager; //Thread safe redis client/conn factory
public RedisQueueHandlerWorker(IRedisClientsManager clientsManager, RedisMqServer mqServer, string queueName, Action<IQueueHandlerBackgroundWorker, Exception> errorHandler)
: base(queueName, errorHandler)
{
if (clientsManager == null) throw new ArgumentNullException("clientsManager");
if (mqServer == null) throw new ArgumentNullException("mqServer");
this.clientsManager = clientsManager;
this.MqServer = mqServer;
}
示例11: AudioAlarmRedisRepository
public AudioAlarmRedisRepository(IKeyGenerator<Guid> keygenerator, IRedisClientsManager manager)
{
if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
if (manager == null) throw new ArgumentNullException(nameof(manager));
this.keygenerator = keygenerator;
this.manager = manager;
}
示例12: SetClientManager
public static void SetClientManager(IRedisClientsManager clientManager)
{
if (clientManagerStatic != null)
{
throw new InvalidOperationException("Redis Client Manager只能配置一次.");
}
clientManagerStatic = clientManager.ThrowIfNull();
}
示例13: MessageHandlerWorker
public MessageHandlerWorker(
IRedisClientsManager clientsManager, IMessageHandler messageHandler, string queueName,
Action<MessageHandlerWorker, Exception> errorHandler)
{
this.clientsManager = clientsManager;
this.messageHandler = messageHandler;
this.QueueName = queueName;
this.errorHandler = errorHandler;
}
示例14: SetClientManager
/// <summary>
/// Sets the client manager to be used for the session state provider.
/// This client manager's lifetime will not be managed by the RedisSessionStateProvider.
/// However, if this is not set, a client manager will be created and
/// managed by the RedisSessionStateProvider.
/// </summary>
/// <param name="clientManager"></param>
public static void SetClientManager(IRedisClientsManager clientManager)
{
if (clientManager == null) throw new ArgumentNullException();
if (clientManagerStatic != null)
{
throw new InvalidOperationException("The client manager can only be configured once.");
}
clientManagerStatic = clientManager;
}
示例15: IdGeneratorSvc
/// <summary>
/// Constructor
/// </summary>
public IdGeneratorSvc(IRedisClientsManager redisManager,
IConfigurationSvc configurationSvc,
ILoggerFactory loggerFactory)
{
this.redisManager = redisManager;
logger = loggerFactory.GetLogger(GetType());
idKeyPrefix = configurationSvc.GetStringConfig("IdGenerator:$Internal$:KeyPrefix", "BHS:IdGenKey:");
idKeyPrefix = StringUtils.MustEndWith(idKeyPrefix, ":");
logger.Info("Using " + idKeyPrefix + " as prefix for id generation keys in Redis");
}