I would save to both the db and the session when changes are made and
read from the database to the session on login and then read from the
session while it's active.

If there is a memory limitation on the server that you risk hitting
because you have too many users that all have too many favorites all
at the same time, then you could just as easily save the favorites to
a cookie instead regardless of database or whatever.


On Sep 23, 8:55 pm, Nico Andrade <shosoieltiernodelage...@gmail.com>
wrote:
> Hi
>
> yes, I agree on this too; but I also trust on Dave decition. I think that if
> he took the time to check the session filesize he is smart enough to note
> this obvious manner too; and I think that if he asks about storing this in
> sessions is because in some way it's important to have that information
> quickly.
>
> I mean that if the favorites is not very very important, I would use the DB
> approach too instead of working in a session. But he asked this for some
> reason that we don't know and because of that we can only reply his question
> instead of giving a more detailed solution.
>
> What I would do, if the info is important enough, is to:
>
> a (and necessary) - put the info in DB in a table as JBloutus suggests,
> indexing both fields.
> b-Put that information in memcache instead of Sessions.
> c-Use Cake caching engine as default, without Memcache.
>
> Best!
>
>
>
> On Thu, Sep 23, 2010 at 11:06 PM, j.blotus <j.blo...@gmail.com> wrote:
> > Why not just create a new table to store the favorites?
>
> > UserFavorites
> > id
> > user_id
> > post_id
>
> > seems like it would be better than using a session
>
> > On Sep 23, 5:13 pm, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > > I have my Users who save favourite Posts
>
> > > At login I get all the saved Posts id's and save then to the users
> > session,
> > > when they save new one it adds it's ID to the list, delete removes the ID
> > > from the session. Now this list can get rather long as you can imagine
> > say
> > > roughly 200 saved favourite id's.
>
> > > Now rather than Session I have the option of CACHE to do the same thing.
> > > Cache the users fav's on login, add / delete to the cached list.
>
> > > Session seems best since its created and deleted on login / logout but is
> > > there a performance difference from the 2 that anyone knows of? I made a
> > > dummy files with 1000 id's and the file size was 7k so its still rather a
> > > small amount of data. So sticking with the session seems best but would
> > like
> > > to hear what others think.
>
> > > Any feedback would be great.
>
> > > Thanks.
>
> > > Dave
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c 
> > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to