Hangfire.PostgreSql icon indicating copy to clipboard operation
Hangfire.PostgreSql copied to clipboard

Cache all SQL queries using sliding expiration

Open azygis opened this issue 2 years ago • 4 comments

Closes #278.

azygis avatar Mar 13 '23 16:03 azygis

I don't really get this. Is building a simple string really slower than retrieving it from cache?

Why are you using expiration? Do you think the options could change over time?

frankhommers avatar Apr 19 '23 09:04 frankhommers

The broader discussion is in #278, let's keep it there. "Slower" maybe not, but keeping allocations at minimum is always a good idea.

Regarding the expiration - there's no point in keeping the queries in memory indefinitely when there is no need for them for an extended period of time, for example any of the dashboard queries are irrelevant if you just check it occasionally, therefore can just expire.

azygis avatar Apr 19 '23 09:04 azygis

I would choose a sliding expiration of 2 hours, instead of 30 minutes. That feels more feasible to me.

Did you compare benchmarks of previous versions and this one to compare allocations?

frankhommers avatar Apr 19 '23 19:04 frankhommers

I did as mentioned in the comment. It might be that the pull request isn't even worth it, hence it's still idling here. First want to try a few things from the linked issue, but free time is too limited right now.

azygis avatar Apr 19 '23 19:04 azygis

Closing as it's not something that's really beneficial.

azygis avatar Apr 15 '24 09:04 azygis