Trying to set cachetools cache class
- more specifically the LRUCache inheriting from it.
I want to set maxsize based on bytes - which means I need to set getsizeof parameter with some lambda function for calculation of object's size of in bytes.
Looking into sys.getsizeof, we can see it's not suitable as I'm about to save in cache custom class with referenced\handles to other objects which will be the critic mass.
Any ideas how can I calculate real bytes in memory for python custom object and what it contains, meaning calculating also referenced size (not pointer size but its content)
Thanks