telebot
telebot copied to clipboard
Cache
There are multiple places in the bot which could benefit from the use of in-house caching. Namely, (a) inline results, and (b) currently non-existent user context.
// Cache implements a cache store.
type Cache interface {
Get(kind Item, key, value string) (string, error)
Put(kind Item, key, value string) error
Clear(kind Item, key) error
}
It's not yet clear what exact API and fine–tuning controls will be used, but one thing that is absolutely clear is that the store might be chosen depending on the kind of cache item, i.e. inline query results are better stored in a global cache, whereas the state of the user is better kept in-memory within a single instance. Different arrangements could be introduced.
Telegram should implement an in-memory cache, redis, and possibly, GAE memcached.
Cache will most likely have to rely on #291.