|
@@ -1,17 +0,0 @@
|
1
|
|
-from django.core.cache import cache
|
2
|
|
-
|
3
|
|
-from sorl.thumbnail.conf import settings
|
4
|
|
-from sorl.thumbnail.kvstores.cached_db_kvstore import KVStore
|
5
|
|
-from sorl.thumbnail.models import KVStore as KVStoreModel
|
6
|
|
-
|
7
|
|
-
|
8
|
|
-class ConcurrentKVStore(KVStore):
|
9
|
|
- """
|
10
|
|
- Custom KV store for Sorl to avoid integrity errors when settings new
|
11
|
|
- values.
|
12
|
|
- """
|
13
|
|
-
|
14
|
|
- def _set_raw(self, key, value):
|
15
|
|
- KVStoreModel.objects.get_or_create(
|
16
|
|
- key=key, defaults={'value': value})
|
17
|
|
- cache.set(key, value, settings.THUMBNAIL_CACHE_TIMEOUT)
|