From 603e01807361242d47d7466e6e8a0f8d4a06fe49 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Sat, 13 Dec 2014 19:05:12 +0100 Subject: [PATCH] Uses set_many instead of multiple adds. --- cachalot/monkey_patch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cachalot/monkey_patch.py b/cachalot/monkey_patch.py index 99471d6..4f3b808 100644 --- a/cachalot/monkey_patch.py +++ b/cachalot/monkey_patch.py @@ -56,8 +56,7 @@ def _get_result_or_execute_query(execute_query_func, cache_key, new_table_cache_keys = frozenset(table_cache_keys) - frozenset(data) if new_table_cache_keys: - for table_cache_key in new_table_cache_keys: - cache.add(table_cache_key, time(), None) + cache.set_many(new_table_cache_keys, time(), None) elif cache_key in data: try: timestamp, result = data.pop(cache_key)