Caching: Initial experitmental cache model

signed-off-by: Roberto Rosario <rosarior@t60.lan>
This commit is contained in:
Roberto Rosario
2018-11-30 19:48:26 -04:00
parent f25174bd15
commit a414b8df92
6 changed files with 148 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from .literals import DEFAULT_DOCUMENT_TYPE_LABEL
from .signals import post_initial_document_type
@@ -21,6 +22,14 @@ def create_default_document_type(sender, **kwargs):
)
def handler_create_document_cache(sender, **kwargs):
Cache = apps.get_model(app_label='common', model_name='Cache')
Cache.objects.get_or_create(
name='document_images', label=_('Document images'),
storage_instance_path='documents.storages.storage_documentimagecache'
)
def handler_scan_duplicates_for(sender, instance, **kwargs):
task_scan_duplicates_for.apply_async(
kwargs={'document_id': instance.document.pk}