synthicity/urbansim — pull request #129 by jiffyclub (2014-11-05 00:08:18+00:00)
Title: Cache scope

This adds a `cache_scope` option to the `table`, `column`, and `injectable` decorators that allow results to be automatically cleared from the cache at set points. The options are `'step'`, `'iter'`, and `'forever'`. Items with scope `'step'` are cleared after every model is run, items with scope `'iter'` are cleared at the end of every model year, and things with scope `'forever'` are never automatically cleared.

This removes the need for `table_source` so that has been removed. The equivalent is now to use `cache_scope='forever'`.

I waffled a little bit on using 'forever' or 'simulation' for the long-lived scope. With a scope of 'simulation' it'd make sense to clear it at the end of the simulation, with 'forever' it'd be best to never clear it. I'm up for either one, anyone have an opinion?