65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using StackExchange.Redis;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EgwCoreLib.Lux.Data.Services
|
|
{
|
|
/// <summary>
|
|
/// Interfaccia servizio REDIS x pub/sub e caching
|
|
/// </summary>
|
|
public interface IRedisService
|
|
{
|
|
#region Public Methods
|
|
|
|
string? Get(string key);
|
|
|
|
Task<string?> GetAsync(string key);
|
|
|
|
long Publish(string channel, string message);
|
|
|
|
Task<long> PublishAsync(string channel, string message);
|
|
|
|
long QueueCount(RedisKey queueName);
|
|
|
|
Task<long> QueueCountAsync(RedisKey queueName);
|
|
|
|
List<RedisValue> QueueListAll(RedisKey queueName);
|
|
|
|
Task<List<RedisValue>> QueueListAllAsync(RedisKey queueName);
|
|
|
|
RedisValue QueuePop(RedisKey queueName);
|
|
|
|
List<RedisValue> QueuePopAll(RedisKey queueName);
|
|
|
|
Task<List<RedisValue>> QueuePopAllAsync(RedisKey queueName);
|
|
|
|
Task<RedisValue> QueuePopAsync(RedisKey queueName);
|
|
|
|
List<RedisValue> QueuePopList(RedisKey queueName, int maxElem);
|
|
|
|
Task<List<RedisValue>> QueuePopListAsync(RedisKey queueName, int maxElem);
|
|
|
|
long QueuePush(RedisKey queueName, RedisValue value);
|
|
|
|
Task<long> QueuePushAsync(RedisKey queueName, RedisValue value);
|
|
|
|
long QueueRemove(RedisKey queueName, RedisValue value);
|
|
|
|
Task<long> QueueRemoveAsync(RedisKey queueName, RedisValue value);
|
|
|
|
bool QueueReset(RedisKey queueName);
|
|
|
|
Task<bool> QueueResetAsync(RedisKey queueName);
|
|
|
|
bool Set(string key, string value, TimeSpan? expiry = null);
|
|
|
|
Task<bool> SetAsync(string key, string value, TimeSpan? expiry = null);
|
|
|
|
void Subscribe(string channel, Action<RedisChannel, RedisValue> handler);
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |