public void Write(CacheItem item){
if (_database.LockTake("worker", "token", TimeSpan.FromMilliseconds(1)))
{
try
{
var cache = JsonConvert.SerializeObject(item);
_database.StringSet("worker", cache, TimeSpan.MaxValue);
}
finally
{
_database.LockRelease("worker", "token");
}
}
}
CacheItem includes counter. multiple worker thread gets value of redis CacheItem, and update the counter. If a worker gets the item, it will update and other can access source and update it. otherwise two or mode worker gets counter as 0 and increase it and all and saves as 1. But itshould be 3.
How can I do this?
Я хочу обновить элемент Redis с помощью блокировки. [code] public void Write(CacheItem item){ if (_database.LockTake("worker", "token", TimeSpan.FromMilliseconds(1))) { try { var cache = JsonConvert.SerializeObject(item); _database.StringSet("worker", cache, TimeSpan.MaxValue); } finally { _database.LockRelease("worker", "token"); } } } [/code] CacheItem includes counter. multiple worker thread gets value of redis CacheItem, and update the counter. If a worker gets the item, it will update and other can access source and update it. otherwise two or mode worker gets counter as 0 and increase it and all and saves as 1. But itshould be 3. How can I do this?
Я могу без проблем подключиться к локальному Windows Docker Redis, однако когда я пробую то же самое с помощью StackExchange.Redis с кэшем Azure Redis, как показано в этом примере...
// Configure GraphQL Gateway Redis Cache...
Я прочитал пример о подписке и публикации в документах stackexchange.redis, но я не понимаю.
Почему пример не говорит о публикации?
var channel = multiplexer.GetSubscriber().Subscribe( messages );
channel.OnMessage(message =>
{...
Я пытаюсь реализовать кеширование Redis в нашей настройке sitecore, но у меня возникли проблемы с этим. Мы используем платформу dotnet 4.8 в контейнерной установке.
Я установил пакет StackExchange.Redis Nuget версии 2.7.27 и пытаюсь выполнить запись...