Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: caching system for InputFile #6

Open
KnorpelSenf opened this issue Jan 8, 2024 · 1 comment
Open

feat: caching system for InputFile #6

KnorpelSenf opened this issue Jan 8, 2024 · 1 comment

Comments

@KnorpelSenf
Copy link
Member

KnorpelSenf commented Jan 8, 2024

A cache library, Which uses caching system for InputFile. For example:

ctx.replyWithPhoto(...)

When i call it twice i want the second to be fast.
Idk if i've elaborated it well

Originally posted by @OfficialCodinary in grammyjs/grammY#110 (comment)

@KnorpelSenf
Copy link
Member Author

How it will work:

  1. Installation via bot.api.config.use(filesCache())
  2. Stores a number of InputFile instances based on the data they contain, ideally with constant-time lookup
  3. Registers a transformer function that adds instances to the cache, and stores the resulting file identifier(s) once the upload has completed
  4. Upon cache hit, the InputFile instance in the payload is replaced by the file identifier received previously if and only if the respective API method permits this according to the specs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant