schneems/Likeable — Issue #12: What is the most efficient way to create a 'likes' stream?
Author: cvrsor
Created: 2011-12-26 13:44:10+00:00
State: open

Hello,

I have added the Likeable library to my app successfully, now each user can like my 'Posts' model. I am currently examining what is the most efficient way to show a _'likes stream'_ in each user's profile page, something like:

```'User XXX liked your post 'Blablablabla' on 25 Dec 2011
User YYY liked your post 'BiriBiriBiriBiri' on 26 Dec 2011'```

I was thinking of implementing a seperate 'list' per Post in my Redis instance, adding the above sentence whenever a like happens. On the other hand, the Likeable library already has the .likes class that lists likes (including users, date etc) for each Post.

I am thinking that using the _.likes_ class may **hinder my app's performance**, indeed everytime a user accesses his profile page, my controller would have to iterate through all his Posts, check if there are any likes for each Post, then retrieve the required information (user id, username, date, etc) and compose the above sentence for every like of every post..

Any suggestions?

Many thanks for your help!
Alex