return result

def write_cache(filename):
    with open(filename, 'ab') as f:
        while True:
            while queue:
                key, value = queue.pop()
f.write(pickle.dumps(key, pickle.HIGHEST_PROTOCOL) + pickle.dumps(value,
    pickle.HIGHEST_PROTOCOL))
f.flush()
time.sleep(1)
Постоянная память в Python