timotejroiko / discord.js-light

All the power of discord.js, zero caching. This library modifies discord.js's internal classes and functions in order to give you full control over its caching behaviour.
Apache License 2.0
292 stars 29 forks source link

Auto sweep #46

Closed Ortovoxx closed 3 years ago

Ortovoxx commented 3 years ago

To be more in line with how discord.js handles automatic message sweeping for channel and user sweeps I added automatic setting of the interval if those client options are present.

Client options match vanilla discord.js client options

timotejroiko commented 3 years ago

We had auto-sweeping before, it was removed when v3 was released. The reasoning was that manual fetching should have manual sweeping, to prevent possible issues when users manually fetch stuff only for it to disappear by itself, aka the user should know what they're doing regarding caching and data retention.

It could be added back if people feel the need for it, however i havent received any requests about it.

Another thing:

How long a channel should stay in the cache until it is considered sweepable

This description is not accurate as the sweep functions remove based on "time since last active" and not "time since cached"

Ortovoxx commented 3 years ago

Ah okay I was unaware that it was implemented and previously removed. As it only sets the interval if the client options are set I don't see why it should be removed? If neither client options are set then there will be no change to the current behaviour.

Just seems a simple implementation rather than the user having to set their own intervals.

timotejroiko commented 3 years ago

with v4 / djs v13 this is now built-in, so im gonna go ahead and close this