Skip to content

Commit

Permalink
make missing directories when using disklru
Browse files Browse the repository at this point in the history
  • Loading branch information
zackees committed May 10, 2023
1 parent 242a1bf commit 284eb76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/disklru/disklru.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Disk-based LRU cache using SQLite.
"""

import os
import sqlite3
from datetime import datetime

Expand All @@ -13,6 +14,7 @@ class DiskLRUCache:

def __init__(self, db_path, max_size):
"""Initializes the cache."""
os.makedirs(os.path.dirname(db_path), exist_ok=True)
self.conn = sqlite3.connect(db_path)
self.closed = False
self.cursor = self.conn.cursor()
Expand Down

0 comments on commit 284eb76

Please sign in to comment.