common-data-caching 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/common_data_caching/callbacks.rb +0 -4
- data/lib/common_data_caching/class_methods.rb +5 -5
- data/lib/common_data_caching.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 799fc5654b06ad34518f953901eca1e9bb7b8fc71239aa15a0307ac1a9cca495
|
4
|
+
data.tar.gz: 5ef2e5c70537a749b9be61123aa05a5014324e428e35d598ebc76eca850caab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f783a29acf2aa84ec03c50829cd29f668c197221ba20a3327b377834efbbd7bc9463a6497704cf01305423c6600c3b4465c8504e1117b744eff685fadfbe4940
|
7
|
+
data.tar.gz: 76e0cf971f736df05a361ef5b442c00c5700615187d2a44b75faa8293dd0a639c6dd3d1193dd22be4fc4aba72fb4aa2afe15929a8ef96c62d114d69c29992614
|
data/README.md
CHANGED
@@ -12,10 +12,6 @@ module CommonDataCaching
|
|
12
12
|
def update_common_data_cache
|
13
13
|
# обновить коллекцию кеша всей сущности
|
14
14
|
self.class.update_common_data_cache
|
15
|
-
|
16
|
-
# удалить отдельно кешированную запись
|
17
|
-
key = self.class.common_cache_key(id)
|
18
|
-
Rails.cache.delete(key)
|
19
15
|
end
|
20
16
|
|
21
17
|
def update_common_data_cache_versions
|
@@ -5,8 +5,8 @@ module CommonDataCaching
|
|
5
5
|
true
|
6
6
|
end
|
7
7
|
|
8
|
-
def common_data_cache_key
|
9
|
-
|
8
|
+
def common_data_cache_key
|
9
|
+
"common-data-caching_#{to_s}"
|
10
10
|
end
|
11
11
|
|
12
12
|
def common_data_cache_collection
|
@@ -18,13 +18,13 @@ module CommonDataCaching
|
|
18
18
|
ordering = cache_opts[:order] || :id
|
19
19
|
|
20
20
|
data = merge(scope).order(ordering).prepare_common_data_collection
|
21
|
-
Rails.cache.write(
|
21
|
+
Rails.cache.write(common_data_cache_key, data)
|
22
22
|
end
|
23
23
|
|
24
24
|
def update_common_data_cache_versions
|
25
|
-
versions = Rails.cache.read('
|
25
|
+
versions = Rails.cache.read('common-data-caching-versions') || {}
|
26
26
|
versions[to_s] = Time.now.to_i
|
27
|
-
Rails.cache.write('
|
27
|
+
Rails.cache.write('common-data-caching-versions', versions)
|
28
28
|
end
|
29
29
|
|
30
30
|
def prepare_common_data_collection
|
data/lib/common_data_caching.rb
CHANGED