diff --git a/headphones/db.py b/headphones/db.py index 985f6b72..871b7c99 100644 --- a/headphones/db.py +++ b/headphones/db.py @@ -33,6 +33,9 @@ db_lock = threading.Lock() def dbFilename(filename="headphones.db"): return os.path.join(headphones.DATA_DIR, filename) + +def getCacheSize(): + return int(headphones.CACHE_SIZEMB) class DBConnection: @@ -45,7 +48,7 @@ class DBConnection: #journal disabled since we never do rollbacks self.connection.execute("PRAGMA journal_mode = OFF") #64mb of cache memory,probably need to make it user configurable - self.connection.execute("PRAGMA cache_size=-%s" % (headphones.CACHE_SIZEMB*1024)) + self.connection.execute("PRAGMA cache_size=-%s" % (getCacheSize()*1024)) self.connection.row_factory = sqlite3.Row def action(self, query, args=None):