i’m working on a project that that will work similar to facebook, in my app i have a Posts Entity that a user can add. Those posts are available for other users on thier wall (a page where user can scroll posts).
What i am i even asking for ?
I’m looking for a suggestion for an algorithm ? or tips something like that. How to make such an algorithm that will will meet the criteria.
-
Posts that are sended to user cannot repat ? should i store PostId? is this a good approach ?
-
On each Application restart post can be send to user again but if there are some changes (excluding post edit), what i mean by that is for e.x a new comment added to post or some.
public IEnumerable<PostDto> IPostService.wallFill(int userId)
{
var postInit = _dbContext.Posts.Where().Take(10);
}
public IEnumerable<PostDto> IPostService.wallInit(int userId)
{
var postInit = _dbContext.Posts.Where().Take(3);
}
here are 2 function that i wore they are not finished
or maybe i should say i just deleted code cause i want to make it the best way.
wallInit
– is a function i initialize page with posts
wallFill
– is called when scroll posisiotn is near end enough so new post can be loaded giving a effect of infinite wall with post
What i tried ?
I have tried to make an algorithm that store PostId mapped with UserId and every time new post are send this if statments
are checked.
- if
userId
exist in 2 dimendional array algorithm take column withPostId
and simply check that this post id already exist in column.
Why i decided to erase that code ?
-
i think that this approach is very memory consuming and if this app or other similar project that will maybe be realsed to public in future cannot go for this approach. This would cause my a “memory overload” for many users
-
in this approach 2 dim array should be cleared on fixed time(e.x each 24h period). If many users will use this app this will cause a system break ? or will take to much computing power.