| Sometimes you just need to store data for a short time; cached-table can be used to automate the process of clearing data that you might not need anymore. For example, in the Arc server, continuations are kept in a table of fnid's. In the Arc server code, the table is periodically cleared. However, by using cached-table, you no longer have to write the code explicitly. Instead, each time the table is accessed, old data is cleared. By default data that hasn't been accessed for more than 2 hours is deleted, but you can modify this by specifying a 'cachetime parameter, in seconds. cached-table is now used by Arki, the wiki in Anarki; Arki uses this to store the formatted pages. * I originally planned to have the old data cleared by a background thread, but Arc doesn't have weak references T.T TODO: study just how, exactly, 'atomic should be used to ensure atomicity; also, use of threads. |