summaryrefslogtreecommitdiff
path: root/requests_cache/backends/sqlite.py
diff options
context:
space:
mode:
authorRoman <reclosedev@gmail.com>2012-04-09 20:41:55 +0400
committerRoman <reclosedev@gmail.com>2012-04-09 20:41:55 +0400
commit17e24a163d1270fe45beb10c45e6604878f2992b (patch)
treecd43f4e7f7aab683fbd469c48fecd8f37b2774f2 /requests_cache/backends/sqlite.py
parent3d22a4653d7c0aa16ee668c145efc607ddf7f511 (diff)
downloadrequests-cache-17e24a163d1270fe45beb10c45e6604878f2992b.tar.gz
sqlite cache now stored in one database into different tables
Diffstat (limited to 'requests_cache/backends/sqlite.py')
-rw-r--r--requests_cache/backends/sqlite.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/requests_cache/backends/sqlite.py b/requests_cache/backends/sqlite.py
index 29088a2..6bf20d5 100644
--- a/requests_cache/backends/sqlite.py
+++ b/requests_cache/backends/sqlite.py
@@ -7,7 +7,7 @@
``sqlite3`` cache backend
"""
from requests_cache.backends.base import MemoryCache
-from requests_cache.backends.dbdict import DbPickleDict
+from requests_cache.backends.dbdict import DbDict, DbPickleDict
class DbCache(MemoryCache):
@@ -15,16 +15,12 @@ class DbCache(MemoryCache):
Reading is fast, saving is a bit slower. It can store big amount of data
with low memory usage.
-
- It stores cache data to two files (for ``location = 'cache'``):
-
- - ``cache_urls.sqlite``
- - ``cache_responses.sqlite``
"""
def __init__(self, location='cache', *args, **kwargs):
"""
:param location: database filename prefix (default: ``'cache'``)
"""
super(DbCache, self).__init__(*args, **kwargs)
- self.url_map = DbPickleDict('%s_urls' % location)
- self.responses = DbPickleDict('%s_responses' % location)
+ self.responses = DbPickleDict(location, 'responses')
+ self.url_map = DbDict(location, 'urls', self.responses)
+