README.md in kredis-0.4.0 vs README.md in kredis-1.0.0
- old
+ new
@@ -142,11 +142,12 @@
flag.mark # => SET myflag 1
true == flag.marked? # => EXISTS myflag
flag.remove # => DEL myflag
false == flag.marked? # => EXISTS myflag
-flag.mark(expires_in: 1.second) #=> SET myflag 1 EX 1
+true == flag.mark(expires_in: 1.second, force: false) #=> SET myflag 1 EX 1 NX
+false == flag.mark(expires_in: 10.seconds, force: false) #=> SET myflag 10 EX 1 NX
true == flag.marked? #=> EXISTS myflag
sleep 0.5.seconds
true == flag.marked? #=> EXISTS myflag
sleep 0.6.seconds
false == flag.marked? #=> EXISTS myflag
@@ -172,13 +173,13 @@
kredis_enum :morning, values: %w[ bright blue black ], default: "bright"
end
person = Person.find(5)
person.names.append "David", "Heinemeier", "Hansson" # => RPUSH people:5:names "David" "Heinemeier" "Hansson"
-true == person.morning.bright? # => GET people:1:morning
-person.morning.value = "blue" # => SET people:1:morning
-true == person.morning.blue? # => GET people:1:morning
+true == person.morning.bright? # => GET people:5:morning
+person.morning.value = "blue" # => SET people:5:morning
+true == person.morning.blue? # => GET people:5:morning
```
You can also define `after_change` callbacks that trigger on mutations:
```ruby
@@ -240,9 +241,19 @@
}
)
```
The above code could be added to either `config/environments/production.rb` or an initializer. Please ensure that your client private key, if used, is stored your credentials file or another secure location.
+
+### Configure how the redis client is created
+
+You can configure how the redis client is created by setting `config.connector` in your `application.rb`:
+
+```ruby
+config.kredis.connector = ->(config) { SomeRedisProxy.new(config) }
+```
+
+By default Kredis will use `Redis.new(config)`.
## License
Kredis is released under the [MIT License](https://opensource.org/licenses/MIT).