rubyvideo icon indicating copy to clipboard operation
rubyvideo copied to clipboard

Increase Cache Hit Performance

Open justinallenmarsh opened this issue 11 months ago • 1 comments

In the talk show view, the current user is being used in the cache key. I believe this is only used for caching whether a talk is cached or not. This increases the stored cache significantly as a _talk has to be cached for every user who views it. Instead it should use a boolean value to indicate if the talk is watched or not in order for the partial to be cached and shared amongst users.

https://github.com/adrienpoly/rubyvideo/blob/20b2b1a57b6fd823f3c16f6484d877b58e2b56e0/app/views/talks/show.html.erb#L17

justinallenmarsh avatar Jan 14 '25 15:01 justinallenmarsh

I agree this cache key should be simplified. This being said I think most of the visitors are unauthenticated so they all end up in the same cache key.

Probably we could remove this part from the cache key @talk.watched_talks.where(user: Current.user) if we wheere to add a touch: true to the watched_talk user association

adrienpoly avatar Jan 14 '25 21:01 adrienpoly