CachedDOData.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. class CachedDOData:
  2. # base class for objects that are used to store data in the CRDataCache
  3. #
  4. # stores a minimal set of cached data for DistributedObjects between instantiations
  5. def __init__(self):
  6. # override and store cached data
  7. # this object now owns the data
  8. # ownership will either pass back to another instantion of the object,
  9. # or the data will be flushed
  10. pass
  11. def destroy(self):
  12. # override and handle this object being destroyed
  13. # this is destruction of this object, not the cached data (see flush)
  14. pass
  15. def flush(self):
  16. # override and destroy the cached data
  17. # cached data is typically created by the DistributedObject and destroyed here
  18. pass
  19. # These next two methods tell mypy to allow arbitrary attributes.
  20. def __getattribute__(self, name: str):
  21. return object.__getattribute__(self, name)
  22. def __setattr__(self, name: str, value) -> None:
  23. object.__setattr__(self, name, value)