put method

void put(
  1. String messageId,
  2. CachedPreview preview
)

Puts a preview in the cache

Implementation

void put(String messageId, CachedPreview preview) {
  try {
    if (_cache.length >= maxCacheSize) {
      // Remove oldest entry (LRU eviction)
      final oldestKey = _cache.keys.first;
      _cache.remove(oldestKey);
    }
    _cache[messageId] = preview;
  } catch (e) {
    debugPrint('Cache put failed: $e');
  }
}