telebot icon indicating copy to clipboard operation
telebot copied to clipboard

Cache

Open tucnak opened this issue 5 years ago • 1 comments

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.

tucnak avatar May 11 '20 14:05 tucnak

Cache will most likely have to rely on #291.

tucnak avatar May 13 '20 12:05 tucnak