Skip to content

Commit

Permalink
Fixed Cache._accessed updating the wrong time field
Browse files Browse the repository at this point in the history
  • Loading branch information
npalacioescat committed Sep 19, 2024
1 parent 6e08eb8 commit 278be4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cache_manager/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,10 +1286,10 @@ def _accessed(self, item_or_id: int | CacheItem):
item_or_id = self.search(ids = item_or_id)[0]

self.update(
item_id = item_or_id.key,
key = item_or_id.key,
update = {
'read_count': item_or_id.read_count + 1,
'date': datetime.datetime.now(),
'last_read': datetime.datetime.now(),
},
)

Expand Down
1 change: 0 additions & 1 deletion tests/test_accessed.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def test_last_read(test_cache):
f.write("Something")

it._open()

q = f'SELECT datetime(last_read, "localtime"), read_count FROM main WHERE id = {it._id};'
test_cache._execute(q)
last, count = test_cache.cur.fetchone()
Expand Down

0 comments on commit 278be4c

Please sign in to comment.