S
S
softshape2015-02-13 07:02:19
Django
softshape, 2015-02-13 07:02:19

What is the fastest way to remove a specific key from all Django sessions?

Hello everyone,
we calculate and cache in the session a key (it's called "region") for each of our Django site visitors. Sometimes you need to recalculate its value for all visitors, and for this you first need to remove it from all sessions of all website visitors. What is the best way to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2015-02-13
@softshape

An option that does not have to shovel all sessions:
Store in the session not only the region itself, but also the time it was set, and also store one global variable for the entire site - the reset time of the regions. And with each request for a cached region, compare these two variables, if the region was calculated before the reset - it rots in the cache and is calculated again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question