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

Stateful extensible caching system #6

Open
3 of 4 tasks
Bluenix2 opened this issue Nov 13, 2021 · 0 comments
Open
3 of 4 tasks

Stateful extensible caching system #6

Bluenix2 opened this issue Nov 13, 2021 · 0 comments
Labels
feature New addition to the library wumpy-cache

Comments

@Bluenix2
Copy link
Collaborator

Bluenix2 commented Nov 13, 2021

Summary

So far there has been no gateway caching except for this poor start. The plan is to finish all models (#4) and then make them stateful (#4 (comment)) with knowledge about the RESTClient and this shared cache.

Description

There should be an extensible caching system in Wumpy that the user can hook into to optimize their data structures. An example where this would've been useful is when Python Discord created a ring buffer to improve cross-channel lookup of deleted messages, seen here.

Another benefit is the ease of injecting model subclasses - this has been the plan all along and can be seen in cache start linked above with the cls kwarg to store_user() and store_channel() methods. There's no way to update the typings for the user when they create these subclasses (and for example add new methods) - but that is not blocker and there's workarounds.

One last thing I want this to accomplish is to allow storing objects elsewhere like in Redis or shared-memory SQLite - but that gets complicated quickly as all cache methods need to become coroutine-functions which means that they can't be used inside the __init__() of models. To start with having all cache methods be sync would at least allow shared-memory SQLite to be used.

Tasks

  • Add abstract cache ABC with all methods used by the library.
  • Create default implementation with appropriate data structures for most use-cases.
  • Allow subclasses or completely unrelated implementations of the ABC to be hooked into the library.
  • Evaluate whether asynchronous cache implementations are possible or if they should just be left to the user.
@Bluenix2 Bluenix2 added the feature New addition to the library label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New addition to the library wumpy-cache
Projects
Status: ⚙️ - In Progress
Development

No branches or pull requests

1 participant