-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
feat: add a feature flag to enable the cache #609
base: master
Are you sure you want to change the base?
Conversation
Once we merge with Ferrit, we might have a better option - a runtime configuration option rather than a compile-time configuration. |
I don't think Ferrit is able to disable the cache right now : https://github.com/ferritreader/ferrit/blob/master/src/client.rs#L217 Are you talking about adding a key to https://github.com/ferritreader/ferrit/blob/master/src/settings.rs ? Anyway, I think that having a compile-time flag may be better here since we should not need to toggle the cache on and off. |
ping @spikecodes I want agree with @tirz. I can't see any reason why a host would want to disable the cache on a Libreddit release binary, nor one for offering that feature as a command-line option. The only people who would want to toggle the cache are devs. However, there's a problem: you can't disable an arbitrary default feature (at least not yet). Either all of them are honored, or none of them are if So, I propose a compromise between @tirz's and @sigaloid's positions. Make the cache toggle-able but only if the build is a debug build. This toggle can be either by way of an environment variable or a command-line option. I think an environment variable would be better. Thoughts? |
I support this feature and I think your compromise would be a great way of adding it @Daniel-Valentine though I'm not sure how we could make the cached attribute conditional to the existence of an environment variable as |
That's true. And because it's a attribute that we can't change at runtime, a command-line option won't work either -- I had just gotten a little confused. The more that I think about it, the more that @tirz's is the way to go. Another option is to make a |
I agree - honestly, I feel like with a development build you wouldn't want caching on in general - it won't be facing high load and it would be hard for someone to manually deploy a public instance as a debug build. Should we consider disabling caching for debug builds in general? |
That's true. So we want:
It's bad form to make a feature that disables a feature (like We could split it into two different functions, and optionally call them based off of runtime/environment variables. A |
Personally, I do not want to cache the responses for the release build since my infra already have a cache with varnish (in front of libreddit). |
Sometime, we may already have a cache strategy with varnish or squid.
In that case, the cache offered by libreddit will never hit and just slow down the request (hashmap check from the cached crate) and use more ram for nothing.