Using a global static variable server wide in Django
<p>I have a very long list of objects that I would like to only load from the db once to memory (Meaning not for each session) this list WILL change it's values and grow over time by user inputs, The reason I need it in memory is because I am doing some complex searches on it and want to give a quick answer back.</p>

<p>My question is how do I load a list on the start of the server and keep it alive through sessions letting them all READ/WRITE to it.</p>

<p>Will it be better to do a heavy SQL search instead of keeping the list alive through my server?</p>

<p>The answer is that this is bad idea, you are opening a pandora's box specially since you need write access as well. However all is not lost. You can quite easily use <a href="https://redis-py.readthedocs.io/en/latest/" rel="nofollow">redis</a> for this task.</p>

<p>Redis is a peristent data store but at the same time everything is held in memory. If the redis server runs on the same device as the web server access is almost instantaneous </p>

python django