We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
IntegrityError with Posgresql cache backend
I would like to update the current request with one of http://stackoverflow.com/a/1109198/186202

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kinto/core/cache/postgresql/__init__.py`
Content:
```
1 from __future__ import absolute_import
2 from functools import wraps
3 
4 import os
5 import time
6 
7 from kinto.core import logger
8 from kinto.core.cache import CacheBase
9 from kinto.core.storage.postgresql.client import create_from_config
10 from kinto.core.storage.exceptions import BackendError
11 from kinto.core.utils import json
12 
13 
14 DELAY_BETWEEN_RETRIES_IN_SECONDS = 0.005
15 MAX_RETRIES = 10
16 
17 
18 def retry_on_failure(func):
19     @wraps(func)
20     def wraps_func(self, *args, **kwargs):
21         tries = kwargs.pop('tries', 0)
22         try:
23             return func(self, *args, **kwargs)
24         except BackendError as e:
25             if tries < MAX_RETRIES:
26                 # Skip delay the 2 first times.
27                 delay = max(0, tries - 1) * DELAY_BETWEEN_RETRIES_IN_SECONDS
28                 time.sleep(delay)
29                 return wraps_func(self, tries=(tries + 1), *args, **kwargs)
30             raise e
31     return wraps_func
32 
33 
34 class Cache(CacheBase):
35     """Cache backend using PostgreSQL.
36 
37     Enable in configuration::
38 
39         kinto.cache_backend = kinto.core.cache.postgresql
40 
41     Database location URI can be customized::
42 
43         kinto.cache_url = postgres://user:pass@db.server.lan:5432/dbname
44 
45     Alternatively, username and password could also rely on system user ident
46     or even specified in :file:`~/.pgpass` (*see PostgreSQL documentation*).
47 
48     .. note::
49 
50         Some tables and indices are created when ``kinto migrate`` is run.
51         This requires some privileges on the database, or some error will
52         be raised.
53 
54         **Alternatively**, the schema can be initialized outside the
55         python application, using the SQL file located in
56         :file:`kinto/core/cache/postgresql/schema.sql`. This allows to
57         distinguish schema manipulation privileges from schema usage.
58 
59 
60     A connection pool is enabled by default::
61 
62         kinto.cache_pool_size = 10
63         kinto.cache_maxoverflow = 10
64         kinto.cache_max_backlog = -1
65         kinto.cache_pool_recycle = -1
66         kinto.cache_pool_timeout = 30
67         kinto.cache_poolclass =
68             kinto.core.storage.postgresql.pool.QueuePoolWithMaxBacklog
69 
70     The ``max_backlog``  limits the number of threads that can be in the queue
71     waiting for a connection.  Once this limit has been reached, any further
72     attempts to acquire a connection will be rejected immediately, instead of
73     locking up all threads by keeping them waiting in the queue.
74 
75     See `dedicated section in SQLAlchemy documentation
76     <http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html>`_
77     for default values and behaviour.
78 
79     .. note::
80 
81         Using a `dedicated connection pool <http://pgpool.net>`_ is still
82         recommended to allow load balancing, replication or limit the number
83         of connections used in a multi-process deployment.
84 
85     :noindex:
86     """  # NOQA
87     def __init__(self, client, *args, **kwargs):
88         super(Cache, self).__init__(*args, **kwargs)
89         self.client = client
90 
91     def initialize_schema(self, dry_run=False):
92         # Check if cache table exists.
93         query = """
94         SELECT 1
95           FROM information_schema.tables
96          WHERE table_name = 'cache';
97         """
98         with self.client.connect(readonly=True) as conn:
99             result = conn.execute(query)
100             if result.rowcount > 0:
101                 logger.info("PostgreSQL cache schema is up-to-date.")
102                 return
103 
104         # Create schema
105         here = os.path.abspath(os.path.dirname(__file__))
106         sql_file = os.path.join(here, 'schema.sql')
107 
108         if dry_run:
109             logger.info("Create cache schema from %s" % sql_file)
110             return
111 
112         # Since called outside request, force commit.
113         schema = open(sql_file).read()
114         with self.client.connect(force_commit=True) as conn:
115             conn.execute(schema)
116         logger.info('Created PostgreSQL cache tables')
117 
118     def flush(self):
119         query = """
120         DELETE FROM cache;
121         """
122         # Since called outside request (e.g. tests), force commit.
123         with self.client.connect(force_commit=True) as conn:
124             conn.execute(query)
125         logger.debug('Flushed PostgreSQL cache tables')
126 
127     def ttl(self, key):
128         query = """
129         SELECT EXTRACT(SECOND FROM (ttl - now())) AS ttl
130           FROM cache
131          WHERE key = :key
132            AND ttl IS NOT NULL;
133         """
134         with self.client.connect(readonly=True) as conn:
135             result = conn.execute(query, dict(key=self.prefix + key))
136             if result.rowcount > 0:
137                 return result.fetchone()['ttl']
138         return -1
139 
140     def expire(self, key, ttl):
141         query = """
142         UPDATE cache SET ttl = sec2ttl(:ttl) WHERE key = :key;
143         """
144         with self.client.connect() as conn:
145             conn.execute(query, dict(ttl=ttl, key=self.prefix + key))
146 
147     @retry_on_failure
148     def set(self, key, value, ttl=None):
149         if ttl is None:
150             logger.warning("No TTL for cache key %r" % key)
151         query = """
152         WITH upsert AS (
153             UPDATE cache SET value = :value, ttl = sec2ttl(:ttl)
154              WHERE key=:key
155             RETURNING *)
156         INSERT INTO cache (key, value, ttl)
157         SELECT :key, :value, sec2ttl(:ttl)
158         WHERE NOT EXISTS (SELECT * FROM upsert)
159         """
160         value = json.dumps(value)
161         with self.client.connect() as conn:
162             conn.execute(query, dict(key=self.prefix + key,
163                                      value=value, ttl=ttl))
164 
165     def get(self, key):
166         purge = "DELETE FROM cache WHERE ttl IS NOT NULL AND now() > ttl;"
167         query = "SELECT value FROM cache WHERE key = :key;"
168         with self.client.connect() as conn:
169             conn.execute(purge)
170             result = conn.execute(query, dict(key=self.prefix + key))
171             if result.rowcount > 0:
172                 value = result.fetchone()['value']
173                 return json.loads(value)
174 
175     def delete(self, key):
176         query = "DELETE FROM cache WHERE key = :key"
177         with self.client.connect() as conn:
178             conn.execute(query, dict(key=self.prefix + key))
179 
180 
181 def load_from_config(config):
182     settings = config.get_settings()
183     client = create_from_config(config, prefix='cache_', with_transaction=False)
184     return Cache(client=client, cache_prefix=settings['cache_prefix'])
185
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kinto/core/cache/postgresql/__init__.py b/kinto/core/cache/postgresql/__init__.py
--- a/kinto/core/cache/postgresql/__init__.py
+++ b/kinto/core/cache/postgresql/__init__.py
@@ -148,19 +148,31 @@
     def set(self, key, value, ttl=None):
         if ttl is None:
             logger.warning("No TTL for cache key %r" % key)
+        # Query for PostgreSQL 9.5+
         query = """
+        INSERT INTO cache (key, value, ttl)
+        VALUES (:key, :value, sec2ttl(:ttl))
+        ON CONFLICT (key) DO
+        UPDATE SET value = :value, ttl = sec2ttl(:ttl);
+        """
+        # Query for PostgreSQL 9.4
+        query_pg_94 = """
         WITH upsert AS (
             UPDATE cache SET value = :value, ttl = sec2ttl(:ttl)
-             WHERE key=:key
+             WHERE key = :key
             RETURNING *)
         INSERT INTO cache (key, value, ttl)
         SELECT :key, :value, sec2ttl(:ttl)
-        WHERE NOT EXISTS (SELECT * FROM upsert)
+        WHERE NOT EXISTS (SELECT * FROM upsert);
         """
         value = json.dumps(value)
+        params = dict(key=self.prefix + key, value=value, ttl=ttl)
         with self.client.connect() as conn:
-            conn.execute(query, dict(key=self.prefix + key,
-                                     value=value, ttl=ttl))
+            server_version = conn.connection().dialect.server_version_info
+            if server_version >= (9, 5):
+                conn.execute(query, params)
+            else:
+                conn.execute(query_pg_94, params)
 
     def get(self, key):
         purge = "DELETE FROM cache WHERE ttl IS NOT NULL AND now() > ttl;"

{"golden_diff": "diff --git a/kinto/core/cache/postgresql/__init__.py b/kinto/core/cache/postgresql/__init__.py\n--- a/kinto/core/cache/postgresql/__init__.py\n+++ b/kinto/core/cache/postgresql/__init__.py\n@@ -148,19 +148,31 @@\n     def set(self, key, value, ttl=None):\n         if ttl is None:\n             logger.warning(\"No TTL for cache key %r\" % key)\n+        # Query for PostgreSQL 9.5+\n         query = \"\"\"\n+        INSERT INTO cache (key, value, ttl)\n+        VALUES (:key, :value, sec2ttl(:ttl))\n+        ON CONFLICT (key) DO\n+        UPDATE SET value = :value, ttl = sec2ttl(:ttl);\n+        \"\"\"\n+        # Query for PostgreSQL 9.4\n+        query_pg_94 = \"\"\"\n         WITH upsert AS (\n             UPDATE cache SET value = :value, ttl = sec2ttl(:ttl)\n-             WHERE key=:key\n+             WHERE key = :key\n             RETURNING *)\n         INSERT INTO cache (key, value, ttl)\n         SELECT :key, :value, sec2ttl(:ttl)\n-        WHERE NOT EXISTS (SELECT * FROM upsert)\n+        WHERE NOT EXISTS (SELECT * FROM upsert);\n         \"\"\"\n         value = json.dumps(value)\n+        params = dict(key=self.prefix + key, value=value, ttl=ttl)\n         with self.client.connect() as conn:\n-            conn.execute(query, dict(key=self.prefix + key,\n-                                     value=value, ttl=ttl))\n+            server_version = conn.connection().dialect.server_version_info\n+            if server_version >= (9, 5):\n+                conn.execute(query, params)\n+            else:\n+                conn.execute(query_pg_94, params)\n \n     def get(self, key):\n         purge = \"DELETE FROM cache WHERE ttl IS NOT NULL AND now() > ttl;\"\n", "issue": "IntegrityError with Posgresql cache backend\nI would like to update the current request with one of http://stackoverflow.com/a/1109198/186202\n", "before_files": [{"content": "from __future__ import absolute_import\nfrom functools import wraps\n\nimport os\nimport time\n\nfrom kinto.core import logger\nfrom kinto.core.cache import CacheBase\nfrom kinto.core.storage.postgresql.client import create_from_config\nfrom kinto.core.storage.exceptions import BackendError\nfrom kinto.core.utils import json\n\n\nDELAY_BETWEEN_RETRIES_IN_SECONDS = 0.005\nMAX_RETRIES = 10\n\n\ndef retry_on_failure(func):\n    @wraps(func)\n    def wraps_func(self, *args, **kwargs):\n        tries = kwargs.pop('tries', 0)\n        try:\n            return func(self, *args, **kwargs)\n        except BackendError as e:\n            if tries < MAX_RETRIES:\n                # Skip delay the 2 first times.\n                delay = max(0, tries - 1) * DELAY_BETWEEN_RETRIES_IN_SECONDS\n                time.sleep(delay)\n                return wraps_func(self, tries=(tries + 1), *args, **kwargs)\n            raise e\n    return wraps_func\n\n\nclass Cache(CacheBase):\n    \"\"\"Cache backend using PostgreSQL.\n\n    Enable in configuration::\n\n        kinto.cache_backend = kinto.core.cache.postgresql\n\n    Database location URI can be customized::\n\n        kinto.cache_url = postgres://user:pass@db.server.lan:5432/dbname\n\n    Alternatively, username and password could also rely on system user ident\n    or even specified in :file:`~/.pgpass` (*see PostgreSQL documentation*).\n\n    .. note::\n\n        Some tables and indices are created when ``kinto migrate`` is run.\n        This requires some privileges on the database, or some error will\n        be raised.\n\n        **Alternatively**, the schema can be initialized outside the\n        python application, using the SQL file located in\n        :file:`kinto/core/cache/postgresql/schema.sql`. This allows to\n        distinguish schema manipulation privileges from schema usage.\n\n\n    A connection pool is enabled by default::\n\n        kinto.cache_pool_size = 10\n        kinto.cache_maxoverflow = 10\n        kinto.cache_max_backlog = -1\n        kinto.cache_pool_recycle = -1\n        kinto.cache_pool_timeout = 30\n        kinto.cache_poolclass =\n            kinto.core.storage.postgresql.pool.QueuePoolWithMaxBacklog\n\n    The ``max_backlog``  limits the number of threads that can be in the queue\n    waiting for a connection.  Once this limit has been reached, any further\n    attempts to acquire a connection will be rejected immediately, instead of\n    locking up all threads by keeping them waiting in the queue.\n\n    See `dedicated section in SQLAlchemy documentation\n    <http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html>`_\n    for default values and behaviour.\n\n    .. note::\n\n        Using a `dedicated connection pool <http://pgpool.net>`_ is still\n        recommended to allow load balancing, replication or limit the number\n        of connections used in a multi-process deployment.\n\n    :noindex:\n    \"\"\"  # NOQA\n    def __init__(self, client, *args, **kwargs):\n        super(Cache, self).__init__(*args, **kwargs)\n        self.client = client\n\n    def initialize_schema(self, dry_run=False):\n        # Check if cache table exists.\n        query = \"\"\"\n        SELECT 1\n          FROM information_schema.tables\n         WHERE table_name = 'cache';\n        \"\"\"\n        with self.client.connect(readonly=True) as conn:\n            result = conn.execute(query)\n            if result.rowcount > 0:\n                logger.info(\"PostgreSQL cache schema is up-to-date.\")\n                return\n\n        # Create schema\n        here = os.path.abspath(os.path.dirname(__file__))\n        sql_file = os.path.join(here, 'schema.sql')\n\n        if dry_run:\n            logger.info(\"Create cache schema from %s\" % sql_file)\n            return\n\n        # Since called outside request, force commit.\n        schema = open(sql_file).read()\n        with self.client.connect(force_commit=True) as conn:\n            conn.execute(schema)\n        logger.info('Created PostgreSQL cache tables')\n\n    def flush(self):\n        query = \"\"\"\n        DELETE FROM cache;\n        \"\"\"\n        # Since called outside request (e.g. tests), force commit.\n        with self.client.connect(force_commit=True) as conn:\n            conn.execute(query)\n        logger.debug('Flushed PostgreSQL cache tables')\n\n    def ttl(self, key):\n        query = \"\"\"\n        SELECT EXTRACT(SECOND FROM (ttl - now())) AS ttl\n          FROM cache\n         WHERE key = :key\n           AND ttl IS NOT NULL;\n        \"\"\"\n        with self.client.connect(readonly=True) as conn:\n            result = conn.execute(query, dict(key=self.prefix + key))\n            if result.rowcount > 0:\n                return result.fetchone()['ttl']\n        return -1\n\n    def expire(self, key, ttl):\n        query = \"\"\"\n        UPDATE cache SET ttl = sec2ttl(:ttl) WHERE key = :key;\n        \"\"\"\n        with self.client.connect() as conn:\n            conn.execute(query, dict(ttl=ttl, key=self.prefix + key))\n\n    @retry_on_failure\n    def set(self, key, value, ttl=None):\n        if ttl is None:\n            logger.warning(\"No TTL for cache key %r\" % key)\n        query = \"\"\"\n        WITH upsert AS (\n            UPDATE cache SET value = :value, ttl = sec2ttl(:ttl)\n             WHERE key=:key\n            RETURNING *)\n        INSERT INTO cache (key, value, ttl)\n        SELECT :key, :value, sec2ttl(:ttl)\n        WHERE NOT EXISTS (SELECT * FROM upsert)\n        \"\"\"\n        value = json.dumps(value)\n        with self.client.connect() as conn:\n            conn.execute(query, dict(key=self.prefix + key,\n                                     value=value, ttl=ttl))\n\n    def get(self, key):\n        purge = \"DELETE FROM cache WHERE ttl IS NOT NULL AND now() > ttl;\"\n        query = \"SELECT value FROM cache WHERE key = :key;\"\n        with self.client.connect() as conn:\n            conn.execute(purge)\n            result = conn.execute(query, dict(key=self.prefix + key))\n            if result.rowcount > 0:\n                value = result.fetchone()['value']\n                return json.loads(value)\n\n    def delete(self, key):\n        query = \"DELETE FROM cache WHERE key = :key\"\n        with self.client.connect() as conn:\n            conn.execute(query, dict(key=self.prefix + key))\n\n\ndef load_from_config(config):\n    settings = config.get_settings()\n    client = create_from_config(config, prefix='cache_', with_transaction=False)\n    return Cache(client=client, cache_prefix=settings['cache_prefix'])\n", "path": "kinto/core/cache/postgresql/__init__.py"}], "after_files": [{"content": "from __future__ import absolute_import\nfrom functools import wraps\n\nimport os\nimport time\n\nfrom kinto.core import logger\nfrom kinto.core.cache import CacheBase\nfrom kinto.core.storage.postgresql.client import create_from_config\nfrom kinto.core.storage.exceptions import BackendError\nfrom kinto.core.utils import json\n\n\nDELAY_BETWEEN_RETRIES_IN_SECONDS = 0.005\nMAX_RETRIES = 10\n\n\ndef retry_on_failure(func):\n    @wraps(func)\n    def wraps_func(self, *args, **kwargs):\n        tries = kwargs.pop('tries', 0)\n        try:\n            return func(self, *args, **kwargs)\n        except BackendError as e:\n            if tries < MAX_RETRIES:\n                # Skip delay the 2 first times.\n                delay = max(0, tries - 1) * DELAY_BETWEEN_RETRIES_IN_SECONDS\n                time.sleep(delay)\n                return wraps_func(self, tries=(tries + 1), *args, **kwargs)\n            raise e\n    return wraps_func\n\n\nclass Cache(CacheBase):\n    \"\"\"Cache backend using PostgreSQL.\n\n    Enable in configuration::\n\n        kinto.cache_backend = kinto.core.cache.postgresql\n\n    Database location URI can be customized::\n\n        kinto.cache_url = postgres://user:pass@db.server.lan:5432/dbname\n\n    Alternatively, username and password could also rely on system user ident\n    or even specified in :file:`~/.pgpass` (*see PostgreSQL documentation*).\n\n    .. note::\n\n        Some tables and indices are created when ``kinto migrate`` is run.\n        This requires some privileges on the database, or some error will\n        be raised.\n\n        **Alternatively**, the schema can be initialized outside the\n        python application, using the SQL file located in\n        :file:`kinto/core/cache/postgresql/schema.sql`. This allows to\n        distinguish schema manipulation privileges from schema usage.\n\n\n    A connection pool is enabled by default::\n\n        kinto.cache_pool_size = 10\n        kinto.cache_maxoverflow = 10\n        kinto.cache_max_backlog = -1\n        kinto.cache_pool_recycle = -1\n        kinto.cache_pool_timeout = 30\n        kinto.cache_poolclass =\n            kinto.core.storage.postgresql.pool.QueuePoolWithMaxBacklog\n\n    The ``max_backlog``  limits the number of threads that can be in the queue\n    waiting for a connection.  Once this limit has been reached, any further\n    attempts to acquire a connection will be rejected immediately, instead of\n    locking up all threads by keeping them waiting in the queue.\n\n    See `dedicated section in SQLAlchemy documentation\n    <http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html>`_\n    for default values and behaviour.\n\n    .. note::\n\n        Using a `dedicated connection pool <http://pgpool.net>`_ is still\n        recommended to allow load balancing, replication or limit the number\n        of connections used in a multi-process deployment.\n\n    :noindex:\n    \"\"\"  # NOQA\n    def __init__(self, client, *args, **kwargs):\n        super(Cache, self).__init__(*args, **kwargs)\n        self.client = client\n\n    def initialize_schema(self, dry_run=False):\n        # Check if cache table exists.\n        query = \"\"\"\n        SELECT 1\n          FROM information_schema.tables\n         WHERE table_name = 'cache';\n        \"\"\"\n        with self.client.connect(readonly=True) as conn:\n            result = conn.execute(query)\n            if result.rowcount > 0:\n                logger.info(\"PostgreSQL cache schema is up-to-date.\")\n                return\n\n        # Create schema\n        here = os.path.abspath(os.path.dirname(__file__))\n        sql_file = os.path.join(here, 'schema.sql')\n\n        if dry_run:\n            logger.info(\"Create cache schema from %s\" % sql_file)\n            return\n\n        # Since called outside request, force commit.\n        schema = open(sql_file).read()\n        with self.client.connect(force_commit=True) as conn:\n            conn.execute(schema)\n        logger.info('Created PostgreSQL cache tables')\n\n    def flush(self):\n        query = \"\"\"\n        DELETE FROM cache;\n        \"\"\"\n        # Since called outside request (e.g. tests), force commit.\n        with self.client.connect(force_commit=True) as conn:\n            conn.execute(query)\n        logger.debug('Flushed PostgreSQL cache tables')\n\n    def ttl(self, key):\n        query = \"\"\"\n        SELECT EXTRACT(SECOND FROM (ttl - now())) AS ttl\n          FROM cache\n         WHERE key = :key\n           AND ttl IS NOT NULL;\n        \"\"\"\n        with self.client.connect(readonly=True) as conn:\n            result = conn.execute(query, dict(key=self.prefix + key))\n            if result.rowcount > 0:\n                return result.fetchone()['ttl']\n        return -1\n\n    def expire(self, key, ttl):\n        query = \"\"\"\n        UPDATE cache SET ttl = sec2ttl(:ttl) WHERE key = :key;\n        \"\"\"\n        with self.client.connect() as conn:\n            conn.execute(query, dict(ttl=ttl, key=self.prefix + key))\n\n    @retry_on_failure\n    def set(self, key, value, ttl=None):\n        if ttl is None:\n            logger.warning(\"No TTL for cache key %r\" % key)\n        # Query for PostgreSQL 9.5+\n        query = \"\"\"\n        INSERT INTO cache (key, value, ttl)\n        VALUES (:key, :value, sec2ttl(:ttl))\n        ON CONFLICT (key) DO\n        UPDATE SET value = :value, ttl = sec2ttl(:ttl);\n        \"\"\"\n        # Query for PostgreSQL 9.4\n        query_pg_94 = \"\"\"\n        WITH upsert AS (\n            UPDATE cache SET value = :value, ttl = sec2ttl(:ttl)\n             WHERE key = :key\n            RETURNING *)\n        INSERT INTO cache (key, value, ttl)\n        SELECT :key, :value, sec2ttl(:ttl)\n        WHERE NOT EXISTS (SELECT * FROM upsert);\n        \"\"\"\n        value = json.dumps(value)\n        params = dict(key=self.prefix + key, value=value, ttl=ttl)\n        with self.client.connect() as conn:\n            server_version = conn.connection().dialect.server_version_info\n            if server_version >= (9, 5):\n                conn.execute(query, params)\n            else:\n                conn.execute(query_pg_94, params)\n\n    def get(self, key):\n        purge = \"DELETE FROM cache WHERE ttl IS NOT NULL AND now() > ttl;\"\n        query = \"SELECT value FROM cache WHERE key = :key;\"\n        with self.client.connect() as conn:\n            conn.execute(purge)\n            result = conn.execute(query, dict(key=self.prefix + key))\n            if result.rowcount > 0:\n                value = result.fetchone()['value']\n                return json.loads(value)\n\n    def delete(self, key):\n        query = \"DELETE FROM cache WHERE key = :key\"\n        with self.client.connect() as conn:\n            conn.execute(query, dict(key=self.prefix + key))\n\n\ndef load_from_config(config):\n    settings = config.get_settings()\n    client = create_from_config(config, prefix='cache_', with_transaction=False)\n    return Cache(client=client, cache_prefix=settings['cache_prefix'])\n", "path": "kinto/core/cache/postgresql/__init__.py"}]}