CacheKeys.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. namespace Application.Abstractions.Cache;
  2. public static class CacheKeys
  3. {
  4. public const string Config = "config";
  5. public const string FaqCategoryActive = "faq:category:active";
  6. public const string PopupPositionActive = "popup:position:active";
  7. public static string FaqItemByCode(string code) => $"faq:item:{code}";
  8. public static string PopupByCode(string code) => $"popup:{code}";
  9. public static string BannerByCode(string code) => $"banner:{code}";
  10. public static string BannerByCodeActive(string code) => $"banner:{code}:active";
  11. public static string DocumentByCode(string code) => $"document:{code}";
  12. public static string BoardMeta(int boardID) => $"board:meta:{boardID}";
  13. public const string CryptoCategoryActive = "crypto:category:active";
  14. public static string CoinBySymbol(string symbol) => $"crypto:coin:{symbol.ToLower()}";
  15. // Crypto Ticker (market = "KRW-BTC" 형식)
  16. public static string CryptoTickers(string quote) => $"crypto:tickers:{quote.ToLower()}";
  17. public static string CryptoTicker(string market) => $"crypto:ticker:{market.ToLower()}";
  18. public static string CryptoCandle(string market, string type) => $"crypto:candle:{market.ToLower()}:{type}";
  19. // Crypto REST (초기 로딩용)
  20. public const string CryptoMarkets = "crypto:markets";
  21. public static string CryptoTickerDetail(string market) => $"crypto:ticker:detail:{market.ToLower()}";
  22. public static string CryptoTrades(string market) => $"crypto:trades:{market.ToLower()}";
  23. public static string CryptoOrderbook(string market) => $"crypto:orderbook:{market.ToLower()}";
  24. // Crypto WebSocket Live (실시간용)
  25. public static string CryptoCandleLive(string market, string interval) => $"crypto:candle:live:{market.ToLower()}:{interval}";
  26. public static string CryptoTradeLive(string market) => $"crypto:trade:live:{market.ToLower()}";
  27. public static string CryptoOrderbookLive(string market) => $"crypto:orderbook:live:{market.ToLower()}";
  28. // Chat
  29. public const string ChatGlobalMessages = "chat:global:messages";
  30. public const string ChatConnections = "chat:connections"; // Hash — 실시간 접속자 (전역)
  31. public const string ChatKickChannel = "chat:kick"; // Pub/Sub — 강제 퇴장
  32. // 룸별 채팅 격리 — roomKey = main | stock:{code} | channel:{sid}(레거시)
  33. public static string ChatRoomMessages(string roomKey) => $"chat:room:{roomKey}:messages";
  34. public static string ChatRoomConnections(string roomKey) => $"chat:room:{roomKey}:connections";
  35. public static string ChatRoomConfig(string roomKey) => $"chat:room:{roomKey}:config";
  36. // Member Presence (Online tracker)
  37. public const string MemberOnlineSet = "member:online"; // Set — 1개 이상 connection 보유한 memberID 집합
  38. public static string MemberConnections(int memberID) => $"member:connections:{memberID}"; // Set — 멤버별 활성 connectionId (refcount용)
  39. // AppHub 전역 접속자 (Admin 현재 접속자 페이지)
  40. public const string AppConnections = "app:connections"; // Hash — connectionId → ConnectedUser JSON (게스트 포함)
  41. public const string AppKickChannel = "app:kick"; // Pub/Sub — AppHub 연결 강제 종료
  42. // YouTube
  43. public static string YouTubeChannel(string channelId) => $"youtube:channel:{channelId}";
  44. public static string YouTubeLiveStream(string videoId) => $"youtube:live:{videoId}";
  45. public const string YouTubePubSubChannels = "youtube:pubsub:channels"; // Set — 구독 중인 채널 ID
  46. public const string YouTubeFeedLastPolled = "youtube:feed:lastPolled"; // Hash — channelId → UTC ISO8601 (성공/스킵 무관 매 폴링 시각)
  47. public const string YouTubePubSubLease = "youtube:pubsub:lease"; // Hash — channelId → UTC ISO8601 (lease 만료 예정 시각)
  48. public const string YouTubeApiTestKeyCooldown = "youtube:api:testkey:cooldown"; // 수동 API 키 테스트 버튼 30초 쿨다운
  49. }