-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add invalidate_query_cache command that invalidates all query caches
- Loading branch information
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
from db.crud import get_all_lectures | ||
|
||
|
||
def invalidate_all_query_caches(): | ||
print('invalidating all query caches') | ||
|
||
lectures = get_all_lectures() | ||
for lecture in lectures: | ||
print(f'invalidating cache for lecture {lecture}: ', end='') | ||
queries = lecture.queries() | ||
print(f'found {len(queries)} queries', end='') | ||
for query in queries: | ||
query.cache_is_valid = False | ||
query.save() | ||
print(' done.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters