Version 1.0.0 & aioredis 2.0
Pre-release
Pre-release
·
16 commits
to main
since this release
This version brings support for aioredis 2.0, which is a very large rewrite and breaking change for most projects. This library has changed a bit when it comes to interaction with aioredis, but the API remains mostly the same. Refer to the migration guide below for help on updating your project.
Removed:
- Connection Pool pattern. aioredis v2 has simiplied a lot of the logic revolving around connections, and it has become very difficult to manage it on a low level. You now only need to use whatever methods you want directly, without worrying about managing the connection pool.
RedisSession.pool
RedisSession.close
&RedisSession.closed
(closing sessions is mostly no longer a thing)RedisSessionClosed
exception (same reason as above)- Namespace locking (as per deprecation timeline) which includes:
namespace_lock
,namespace_lock_no_warn
andNamespaceLock
Changed:
RedisSession
now takes a mandatory URL parameter. Seeaioredis.Redis.from_url
- Operations should now be performed on
RedisObject.redis_session.client
, which now validates namespace as well RedisTask
now takes aRedisTaskQueue
instead of just aRedisQueue
.
Added
RedisSessionNotConnected
exceptionRedisSession.connected
(can act as a general replacement for closed, since a session will never be closed once created)- Marked support for python 3.10
Migrating
To migrate from 0.2 to 1.0.0, you need to do the following:
- Add the URL parameter when initializing the session. Refer to
aioredis.Redis.from_url
- Remove all usages of namespace locking if they still exist
- Implement the changes listed in the above sections. The list is comprehensive and can be used as a checklist.
- If you use aioredis directly, follow the migration guide here. Unfortunately, the guide is incomplete. If you are using a static analysis tool, that should help you identify incorrect calls after the update. Here is an (incomplete) list of undocumented API changes which you might find useful:
brpoplpush
andrpoplpush
no longer takesourcekey
anddestkey
, butsrc
anddst
hmset_dict
has been removed. You can usehset
(orhmset
, but that's deprecated) with themapping
kwarg instead- Exceptions have been rewritten, but are lacking in documentation.
- Make sure to specify return type encoding on your redis session if you don’t want bytes returned. This only applies to using the client directly, this library’s types have not changed.
If you encounter other undocumented changes, please report them here and upstream. Changes will be added to this changelog.
Full Changelog: v0.2.0...v1.0.0rc1