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

Rewrite storage interface + implementations to be async-compatible #3

Closed
JWCook opened this issue Nov 21, 2020 · 0 comments · Fixed by #6
Closed

Rewrite storage interface + implementations to be async-compatible #3

JWCook opened this issue Nov 21, 2020 · 0 comments · Fixed by #6
Labels
Milestone

Comments

@JWCook
Copy link
Member

JWCook commented Nov 21, 2020

Currently, all the storage classes use a dict-like interface (collections.abc.MutableMapping). Unfortunately, there is no syntax support in python for async dict operations, e.g.:

class AsyncDict(MutableMapping):
    async def __getitem__(self, key):
        # ...
    async def __setitem__(self, key, value):
        # ...

my_dict = AsyncDict()
await my_dict['key'] = 'value'
await my_dict['key']

So, this will require a new base storage interface that uses regular methods rather than dict operations.

Ideally, it would be good to merge the storage base class with BaseCache, if there is an elegant way to do it. Currently, they are separate so that BaseCache can have separate references to a key -> response collection and a redirect_key -> key collection.

@JWCook JWCook changed the title Convert sqlite backend to aiosqlite Rewrite storage interface + implementations to be async-compatible Nov 21, 2020
@JWCook JWCook closed this as completed in #6 Nov 21, 2020
@JWCook JWCook added this to the v0.2 milestone Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant