common-data-caching 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/common_data_caching/callbacks.rb +4 -0
- data/lib/common_data_caching.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a082bb986847e69fc1e8d00e0ca871c87ba71cf91fdbaad036dbb7212f3a15e
|
4
|
+
data.tar.gz: be69e9b648072e06927fa1808eb17fc6bb2a50cae15bd3fe1cee808439599d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106b64506c7d3ca88b2e5b1caae0e2ab4025475ee07f574983e5d66c0c8fc329e4e8ef1adf0e3d15f15f0bb87b232b836a2f4e4880b6ccb5d858388d0a29357f
|
7
|
+
data.tar.gz: '08f15a5c15f5667d436d8f770d3ccc22561d22272ec998feed7847cc294b6ac21104300a299c9ae0263cac474c39381161169d175704fed08fb35b825695880f'
|
data/README.md
CHANGED
@@ -47,6 +47,14 @@ User.common_data_cache_collection
|
|
47
47
|
CommonDataCaching.versions
|
48
48
|
```
|
49
49
|
|
50
|
+
При необходимости, чтобы не обновлять кеш при создании или редактировании определенной записи, передайте `skip_common_data_caching: true` в качестве аргумента:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
User.create(email: "user@example.com", skip_common_data_caching: true)
|
54
|
+
|
55
|
+
User.find(1).update(name: "User", skip_common_data_caching: true)
|
56
|
+
```
|
57
|
+
|
50
58
|
### Сортировка
|
51
59
|
|
52
60
|
Для применения сортировки, передайте опцию `order`:
|
data/lib/common_data_caching.rb
CHANGED
@@ -58,10 +58,16 @@ ActiveSupport.on_load(:active_record) do
|
|
58
58
|
# методы кеширования
|
59
59
|
extend CommonDataCaching::ClassMethods
|
60
60
|
|
61
|
-
#
|
61
|
+
# коллбэки
|
62
62
|
include CommonDataCaching::Callbacks
|
63
|
-
|
64
|
-
after_commit :
|
63
|
+
|
64
|
+
after_commit :update_common_data_cache,
|
65
|
+
on: %i[create update destroy],
|
66
|
+
if: proc { |i| i.common_data_caching? && i.skip_common_data_caching != true }
|
67
|
+
|
68
|
+
after_commit :update_common_data_cache_versions,
|
69
|
+
on: %i[create update destroy],
|
70
|
+
if: proc { |i| i.common_data_caching? && i.skip_common_data_caching != true }
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: common-data-caching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Павел Бабин
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|