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

Use encoding from the serializer if specified #7

Closed
argaen opened this issue Oct 3, 2016 · 5 comments
Closed

Use encoding from the serializer if specified #7

argaen opened this issue Oct 3, 2016 · 5 comments
Milestone

Comments

@argaen
Copy link
Member

argaen commented Oct 3, 2016

There is an encoding attr defined for serializer because in some cases it is needed for aioredis. To keep the interface clean, the encoding part should be done in the serializer layer. This will help also in the case of memcached implementation

@argaen argaen modified the milestone: 0.1.0 Oct 5, 2016
@argaen
Copy link
Member Author

argaen commented Oct 8, 2016

Need to think more about it. Redis for example needs always to have an encoding when calling get. The encoding should be 'utf-8' in order to return a string.

The problem is that if this logic is moved to the serializers, depending on which backend is using it, it must explicitly say which encoding must use every time is being initialized...

@argaen
Copy link
Member Author

argaen commented Oct 14, 2016

This definitely has to go to the serializer side, have a look at #20. The methods become messy just because the aiomcache client is always working with bytes. Need to move all this logic to the serializer

@argaen
Copy link
Member Author

argaen commented Oct 24, 2016

Can't be moved 100% to serializers... the users shouldnt know which encoding the backend does support but the backend can't deal 100% with that either.

For example, the following case: Imagine we set 'utf-8' as encoding for Redis backend. It stores bytes but then we want to retrieve strings so we are encoding/decoding every time a new value is saved/retrieved. Now imagine we are using the Pickleserializer which by default it already returns bytes... a UnicodeDecodeError will be raised =/.

Still need to think how to get around with this. Updated a bit the logic but the problem persists.

4627e4f

@argaen argaen closed this as completed Oct 24, 2016
@argaen argaen reopened this Oct 24, 2016
@argaen argaen modified the milestones: 0.2.0, 0.1.0 Oct 24, 2016
@argaen
Copy link
Member Author

argaen commented Oct 30, 2016

With #42 it may be possible to implement

@argaen
Copy link
Member Author

argaen commented Oct 30, 2016

In fact, this is related with #37 and once fixed, this one will also be solved. Closing it and moving the discussion to #37

@argaen argaen closed this as completed Oct 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant