errbotio / err-backend-slackv3

Slack Events and RTM backend for Errbot
GNU General Public License v3.0
27 stars 28 forks source link

Caching content #3

Open duhow opened 3 years ago

duhow commented 3 years ago

One of the main concers using WebClient is that every time a Person is created or a Room is named, Errbot has to call the Slack API several times to get each piece of information. Every. Single. Message.

From #2 I'm using lru_cache to address this, but a time-based cache would be the best option in here, or even having some control to drop cache for a user when the bot does some action, such as changing the topic of a channel.

nzlosh commented 3 years ago

I've noticed multiple calls when the bot looks up server side data. I like the idea of avoiding wasting calls to Slack if the bot has the information already. The only thing to be careful with caching is that it doesn't become stale and the bot return information that doesn't agree with Slack's state.

duhow commented 3 years ago
 16384 Oct 25 15:50 slack_backend.db
 16384 Oct 25 15:59 text_backend.db

If this is true and I can use the Errbot Storage system to store the data, that would solve it! :D