redis-objects-preloadable 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +22 -0
- data/lib/redis/objects/preloadable/relation_extension.rb +6 -0
- data/lib/redis/objects/preloadable/version.rb +1 -1
- 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: a44062b18cd9ef7c2fed29f9bf72f7438f319bb9383727f7c69dcf013d6c98fd
|
|
4
|
+
data.tar.gz: 6d9bbfafa458a31596ac7cf721852e5ea05e50ea2fe9ecb2d30c640e0e46b6e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8197221aca5a63029b05b0a1a7fa4a54bf8a9ac3338f1467a979016647e534fa61c80ec26b3ac2b903ef88afd1866d51619e369e70da54dded7a573b50bd9996
|
|
7
|
+
data.tar.gz: 9dae232377119b913f983a42e0fa999f1ccf5ee48261d231b86b4599837de0c2485937ed867f7d13c1d6e6bdcb3bb8beb3440a5df49e89aa938ae3caed991031
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.2] - 2026-02-22
|
|
4
|
+
|
|
5
|
+
- Fix `RelationExtension#reset` to clear `@redis_preload_context_attached`, so `redis_preload` context is correctly re-attached on every `load` after `reset` (matches AR `.includes` behavior)
|
|
6
|
+
- Document that `record.reload` does not clear preloaded Redis values (by design)
|
|
7
|
+
|
|
3
8
|
## [0.1.1] - 2026-02-22
|
|
4
9
|
|
|
5
10
|
- Fix Rails 8.1 / Ruby 3.4 compatibility: forward all arguments in `ModelExtension.all` override to avoid `ArgumentError` when `ActiveRecord::Persistence#_find_record` calls `all(all_queries: ...)` ([#fix](https://github.com/kyohah/redis-objects-preloadable/issues))
|
data/README.md
CHANGED
|
@@ -105,6 +105,28 @@ Preloading is lazy. The `redis_preload` scope attaches metadata to the relation,
|
|
|
105
105
|
|
|
106
106
|
The type patches are applied via `prepend` on `Redis::Counter`, `Redis::Value`, `Redis::List`, `Redis::Set`, `Redis::SortedSet`, and `Redis::HashKey`.
|
|
107
107
|
|
|
108
|
+
## Limitations
|
|
109
|
+
|
|
110
|
+
### `record.reload` does not clear preloaded values
|
|
111
|
+
|
|
112
|
+
`reload` refreshes DB columns only. Preloaded Redis values remain cached on the redis-objects instances and are **not** updated.
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
widget = Widget.redis_preload(:view_count).first
|
|
116
|
+
widget.view_count.value # => 5 (preloaded)
|
|
117
|
+
|
|
118
|
+
# Another process increments the counter in Redis...
|
|
119
|
+
|
|
120
|
+
widget.reload
|
|
121
|
+
widget.view_count.value # => 5 (still the preloaded value — NOT refreshed)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If you need a fresh Redis value after `reload`, fetch the record again without preloading:
|
|
125
|
+
|
|
126
|
+
```ruby
|
|
127
|
+
Widget.find(widget.id).view_count.value # => hits Redis directly
|
|
128
|
+
```
|
|
129
|
+
|
|
108
130
|
## Backward Compatibility: `read_redis_counter`
|
|
109
131
|
|
|
110
132
|
If your models use the `read_redis_counter` helper (from the original Concern-based approach), it continues to work. With transparent preloading, you can remove explicit `read_redis_counter` calls and access `counter.value` directly.
|