I had the following idea: let's say we have a webapp written using django that models some kind of bulletin board. This board has many threads, but some of them get most posts / views per hour. Stream pages look a little different for each user, so you cannot cache the entire displayed page, and only some parts of the displayed page are also not cached.
My idea: I create an object structure of the stream in memory (with each mail and other data necessary to display it). If a new message is published, the structure is updated, and each post X (or every Y minutes, no matter what comes first), new messages are written back to the database. If the application crashes, some messages are lost, but it is definitely good (for users and administrators).
Question: can I create such a constant in memory without serialization (so no serialize-> memcached)? As far as I understand, WSGI applications (like Django) work in a continuous process without stopping between requests, so this should be possible in theory. Is there any API I could use? If not: any item to view?
/ edit1: I know that "persistent" usually has a different meaning, but in this case, I strictly mean "between requests."
source
share