export interface SplashLatestMessageCacheEntry {
  message: string | null;
}

export interface SplashLatestMessageCache {
  clear(): void;
  get(identity: string): SplashLatestMessageCacheEntry | undefined;
  set(identity: string, message: string | null): void;
}

export function createSplashLatestMessageCache(): SplashLatestMessageCache {
  const entries = new Map<string, SplashLatestMessageCacheEntry>();

  return {
    clear: () => entries.clear(),
    get: (identity) => entries.get(identity),
    set: (identity, message) => entries.set(identity, { message }),
  };
}
