async-rediscache icon indicating copy to clipboard operation
async-rediscache copied to clipboard

Clarify documentation on RedisObject creation

Open mbaruh opened this issue 3 years ago • 0 comments

The __set_name__ docstring of RedisObject reads:

This class MUST be created as a class attribute, otherwise it will raise
exceptions whenever a method is used. This is because it uses this
method to create a namespace like `MyCog.my_class_attribute` which is
used as a hash name when we store stuff in Redis, to prevent collisions.

This gives the impression that a RedisObject is limited to being assigned to a class variable. In reality, it is possible to assign it to an instance attribute by specifying the namespace argument at init.

The docs should be amended to reflect that.

mbaruh avatar Apr 27 '21 09:04 mbaruh