From ddc07eeea692c3c1ee76fbaaa377e211b799e438 Mon Sep 17 00:00:00 2001
From: Matt Wala <wala1@illinois.edu>
Date: Mon, 25 Sep 2017 22:03:54 -0500
Subject: [PATCH] Use store_if_not_present()

---
 setup.py       | 2 +-
 sumpy/tools.py | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/setup.py b/setup.py
index 6f21ddce..400d1b9f 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ setup(name="sumpy",
 
       install_requires=[
           "loo.py>=2017.2",
-          "pytools>=2017.5",
+          "pytools>=2017.6",
           "boxtree>=2013.1",
           "pytest>=2.3",
           "six",
diff --git a/sumpy/tools.py b/sumpy/tools.py
index 2fbb1883..428fa2a1 100644
--- a/sumpy/tools.py
+++ b/sumpy/tools.py
@@ -393,12 +393,8 @@ class KernelCacheWrapper(object):
         with MinRecursionLimit(3000):
             knl = self.get_optimized_kernel(**kwargs)
 
-        from pytools.persistent_dict import ReadOnlyEntryError
         if CACHING_ENABLED:
-            try:
-                code_cache[cache_key] = knl
-            except ReadOnlyEntryError:
-                pass
+            code_cache.store_if_not_present(cache_key, knl)
 
         return knl
 
-- 
GitLab