Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching conventions? #10

Closed
archonic opened this issue Jan 16, 2019 · 1 comment
Closed

Caching conventions? #10

archonic opened this issue Jan 16, 2019 · 1 comment

Comments

@archonic
Copy link

Hello again :)

I'm wondering if this gem provides any caching conventions. Similar to the example activity feed in the Readme, I have the general format of "Actor preformed action on Resource" for my activity feed items. I therefore need to cache against the Actor (a user) and the Resource. As far as I know, there's 2 ways to solve this.

  1. Query the Actor and Resource before hitting the cache. This isn't very efficient and kind of destroys the point of using a memory store for an activity feed.
  2. Add a cache key to the activity feed item, and manually bust it whenever the Actor or Resource is updated in an activity-feed-significant way.

2 seems like the obvious choice. Perhaps cache keys and bust methods should be a part of the gem?

@archonic
Copy link
Author

A third way to solve this is to expire based only on time. Expiring the activity feed cache every hour will keep it relatively up to date and avoid the vast majority of DB hits. The 2nd solution I proposed is not sensible unless the actor id, resource class and resource id can all be indexed in Redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant