the ring decorator must be top of the staticmethod/classmethod decorator
hmm, i want to make ring raise better error message for that but no simple idea
for the example, switching the ring.lru and staticmethod will fix the problem
if it doesn't need to create an instance, just creating __ring_key__ as a staticmethod or classmethod will solve the self problem
@youknowone, if the usage of __ring_key__ is expected of users, then why is it using the "name scrambling"/"private" naming scheme? Is overriding the __ring_key__ the "idiomatic" way of using ring?
And thanks for checking out Infection Monkey, if there's anything you'd like to know further you can join our chat over at slack or go to infectionmonkey.com to check it out :)
when we are caching a class object, yes for now. i am thinking of using string hash of repr (only when it is user-defined) for out-of-python storages and using python __hash__ for in-python storages as default, but not sure about it yet.
class object -> user-defined object
what was the input type? i wonder which case do you cache a class instead of instance, which is not automatically stringified with type stringifier
Hey. Thanks for being great help! Unfortunatelly I've got a problem that I could pin-point to ring. The problem is that I get the same result regardless of which ObjectId I pass in:
^ Here I pass in just a random ObjectId(should get exception returned from function) but still get the same result
__str__() and __hash__() of different ObjectId returns different strings (I checked)
This also seems to work fine with vanilla functools.lru_cache (don't get the same cached result with any ObjectId)
This is the cached function:
does objectid return different ring key by the value?
__ring_key__()? It's bson.ObjectId. It doesn't have ring key