- ITokenCacheService 인터페이스 및 Redis 기반 TokenCacheService 구현
- Key: device:token:{serviceId}:{deviceId}, TTL: 1시간
- PushWorker single 발송 시 캐시 우선 조회, 미스 시 DB 조회 후 캐시 저장
- DeviceService 등록/수정/삭제/수신동의 변경 시 캐시 무효화
- RedisConnection에 GetServer() 메서드 추가 (서비스별 전체 무효화용)
Closes #154
12 lines
443 B
C#
12 lines
443 B
C#
namespace SPMS.Application.Interfaces;
|
|
|
|
public interface ITokenCacheService
|
|
{
|
|
Task<CachedDeviceInfo?> GetDeviceInfoAsync(long serviceId, long deviceId);
|
|
Task SetDeviceInfoAsync(long serviceId, long deviceId, CachedDeviceInfo info);
|
|
Task InvalidateAsync(long serviceId, long deviceId);
|
|
Task InvalidateByServiceAsync(long serviceId);
|
|
}
|
|
|
|
public record CachedDeviceInfo(string Token, int Platform, bool IsActive, bool PushAgreed);
|