2

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.

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.

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

1 Answer 1

1

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 redis for this task.

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

Sign up to request clarification or add additional context in comments.

2 Comments

Redis does seem like a solution, but do you know of any other libraries that are single threaded like that yet don't persist the data? I am already persisting the data through the django model (And it has complex relations with other models)
Asking for resources is off topic for stack overflow so I cannot answer that comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.