using NeDvachAPI.DBControllers;
using NeDvachAPI.Models;
namespace NeDvachAPI.BufferControllers
{
public class APIThreadBuffer
private static List<Post> ThreadsPrewievs;
private static List<Post>[] Threads = new List<Post>[0];
public static void WriteThreadPreviewsBuffer(List<Post> OPPostsToWrite) //add list of OP-posts and last post to buffer
ThreadsPrewievs = OPPostsToWrite;
}
public static List<Post> GetThreadPreviews()
return ThreadsPrewievs;
public static void WriteThreadsBuffer(List<Post> ThreadToAdd) //add thread's posts from DB to buffer
Threads = Threads.Append(ThreadToAdd).ToArray();
public static List<Post> GetThread(int threadId)
if (threadId < Threads.Length + 1 & threadId != 0)
;
return Threads[threadId - 1];
else return null;
public static void RefreshThread(int threadId)
Threads[threadId - 1] = DBchat.PostsList("b", threadId);