I want to store a large number of IDs and perform an action if ID is not already in Set.
Flask code for better understanding:
@app.route('/store', methods=['GET', 'POST','DELETE', 'PATCH'])
def add_to_bag():
bag = BagService()
id = request.json["ID"]
if id not in bag:
bag.add(id)
perform_action(id)
return True
else
return False
I know that HashSet would be the best option to store such data, but I need to store the state even if the server will suddenly turn off, and also there is not enough ram to keep everything in RAM. I'm looking for the best method to store it (like SQL database, NoSQL database, or any other idea)
from The most efficient method of storing SET of ids
No comments:
Post a Comment