One thing I'd like to do is possibly replace some of the table-based caches I'm using in the combat AI mod with memoization. Especially since if I can use N-to-N memoization to memorize priority values not just for ships, but for ship-weapon combinations, I might have a shot at getting the AI to take into account Armor Piercing and Shield Piercing weapon mods.
To do that I need to be able to flush the entire cache at the start of each turn, and flush the cache just for certain ships when needed.
The first one should be easy I think? I have an ai_turn table that stores information needed only for that turn, if I define the memoized function as an entry in that table the cache should be discarded when the table is, right?
The second one I'm not so sure about. I skimmed Orders\farming.lua, but I didn't see anything that could flush a memorized value just for a particular key. The main place where I saw cache flushing was in reset_food_caches(), and that seems to work by replacing entire function values.
I guess if I really need to though I can continue using tables.