jenkins-job-builder/tests/cachestorage/__init__.py
Darragh Bailey cd266ac728 Write cache to file on CacheStorage object delete
Use a destructor to write out the cache to file when the cache object
object goes out of scope, which will typically be on exit.

This ensures that the CacheStorage class behaviour is fully
encapsulated and doesn't require a caller to be aware to ensure the
cache is saved when finished. Although it may still do so.

Take care to preserve a references to any required modules since python
does not guarantee that any global modules will not be unloaded before
the destructor is called.

Change-Id: I2b066ceff5e23a725132569df85c004cd58b367a
2014-11-07 12:25:25 +00:00

0 lines
Python