Arc Forumnew | comments | leaders | submitlogin
Create your own collection: cached-table
3 points by almkglor 6108 days ago | 4 comments
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.



5 points by eds 6108 days ago | link

Seriously, this Arkani naming thing is starting to bug me, I think we should call it Arki. Or another name that doesn't take a couple of seconds of mental parsing to figure out you're talking about the wiki, not Anarki.

-----

7 points by almkglor 6108 days ago | link

Err, Anarki is a wiki, right? ^^ LOL!

Okay, okay, I'll do s/Arkani/Arki/g ^^.

Edit: done!

-----

1 point by utx00 6107 days ago | link

"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 "

... continuations or plain closures?

-----

1 point by almkglor 6107 days ago | link

There's no real difference between them: continuations are just a type of closure, one which accepts a single argument, the return value of the called function. cref. lambda the ultimate declarative.

-----