messagecache stub

This commit is contained in:
Dan Ballard 2021-12-03 17:15:47 -08:00
parent b0f74ffb6d
commit 20bff8b713
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import 'dart:collection';
import 'package:cwtch/widgets/messagerow.dart';
import 'package:flutter/material.dart';
int MinCacheSize = 20;
class MessageCache extends ChangeNotifier {
final String profile;
Queue<MessageRowState> cacheByIndex = Queue();
Map<int, MessageRowState> cacheById = Map();
MessageCache(this.profile) {}
// So we internall need to fetch by N (new libcwtch API)
// then double store by index and id to support both calls
// monitor activeConversation for unlimited growth and when
// change to not active convo, trigger a shrink
// bonus: dont prune cache by id messages refed in core list
GetMessageByIndex(conversationIdentifier, index);
GetMessageById(conversationIdentifier, index);
}