cache.touch(doc_key, timeout)
+def clear_metadata_cache(document_id: int) -> None:
+ doc_key = get_metadata_cache_key(document_id)
+ cache.delete(doc_key)
+
+
def get_thumbnail_modified_key(document_id: int) -> str:
"""
Builds the key to store a thumbnail's timestamp
from filelock import FileLock
from documents import matching
+from documents.caching import clear_metadata_cache
from documents.classifier import DocumentClassifier
from documents.consumer import parse_doc_title_w_placeholders
from documents.file_handling import create_source_path_directory
Document.objects.filter(pk=instance.pk).update(
filename=instance.filename,
archive_filename=instance.archive_filename,
+ modified=timezone.now(),
)
+ clear_metadata_cache(instance.pk)
except (OSError, DatabaseError, CannotMoveFilesException) as e:
logger.warning(f"Exception during file handling: {e}")