ChatExchange
ChatExchange copied to clipboard
Better caching strategy
We currently cache messages in client https://github.com/Manishearth/ChatExchange/blob/master/chatexchange/client.py#L71
However, these are not updated on edits, and it's cached indefinitely. We should have:
- [ ] A way to keep these up to date, perhaps by pinging the message object with new values on edits/stars
- [ ] A way to clean the cache
- [ ] A way to disable the cache
http://shouldiblamecaching.com
+1 for cache control.
Can I ask how the caching currently works?
From what I can see, you're creating a new instance, adding it to the cache, and returning it. At no point are you actually reading from the cache and returning that data. On new message creation, if that message ID exists in this queue, it's not being fetched, nor utilized.