You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**IMPORTANT: redis-objects 2.0.0 introduces a backwards incompatible change to key naming to fix a longstanding bug. For more information see [issue #213](https://github.com/nateware/redis-objects/issues/231)**
8
+
Important 2.0 changes
9
+
---------------------
10
+
Redis::Objects 2.0 introduces several important backwards incompatible changes.
11
+
Currently 2.0 can be installed with `gem install redis-objects --pre` or by listing it
12
+
explicitly in your Gemfile:
13
+
~~~ruby
14
+
# Gemfile
15
+
gem 'redis-objects', '>= 2.0.0.alpha'
16
+
~~~
17
+
You're encouraged to try it out in test code (not production) to ensure it works for you.
18
+
Official release is expected later in 2022.
19
+
20
+
Key Naming Changes
21
+
==================
22
+
The internal key naming scheme has changed for `Nested::Class::Namespaces` to fix a longstanding bug.
23
+
**This means your existing data in Redis will not be accessible until you call `migrate_redis_legacy_keys`.**
24
+
25
+
To fix this (only needed once), create a script like this:
26
+
27
+
~~~ruby
28
+
classYouClassNameHere < ActiveRecord::Base
29
+
includeRedis::Objects
30
+
# ... your relevant definitions here ...
31
+
end
32
+
33
+
YourClassName.migrate_redis_legacy_keys
34
+
~~~
9
35
36
+
Then, you need to find a time when you can temporarily pause writes to your redis server
37
+
so that you can run that script. It uses `redis.scan` internally so it should be able to
38
+
handle a high number of keys. For large data sets, it could take a while.
39
+
40
+
For more details on the issue and fix refer to [#213](https://github.com/nateware/redis-objects/issues/231).
41
+
42
+
Rename of `lock` Method
43
+
=======================
44
+
The `lock` method that collided with `ActiveRecord::Base` has been renamed `redis_lock`.
45
+
This means your classes need to be updated to call `redis_lock` instead:
46
+
47
+
~~~ruby
48
+
classYouClassNameHere < ActiveRecord::Base
49
+
includeRedis::Objects
50
+
redis_lock :mylock# formerly just "lock"
51
+
end
52
+
~~~
53
+
54
+
For more details on the issue and fix refer to [#213](https://github.com/nateware/redis-objects/issues/231).
55
+
56
+
Overview
57
+
--------
10
58
This is **not** an ORM. People that are wrapping ORM’s around Redis are missing the point.
11
59
12
60
The killer feature of Redis is that it allows you to perform _atomic_ operations
@@ -121,7 +169,7 @@ Here's an example that integrates several data types with an ActiveRecord model:
121
169
classTeam < ActiveRecord::Base
122
170
includeRedis::Objects
123
171
124
-
lock:trade_players, :expiration => 15# sec
172
+
redis_lock:trade_players, :expiration => 15# sec
125
173
value :at_bat
126
174
counter :hits
127
175
counter :runs
@@ -526,7 +574,7 @@ Locks work similarly. On completion or exception the lock is released:
0 commit comments