kredis 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kredis might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +8 -23
- data/lib/install/install.rb +6 -0
- data/lib/install/shared.yml +15 -0
- data/lib/kredis/railtie.rb +5 -0
- data/lib/kredis/types/callbacks_proxy.rb +1 -1
- data/lib/kredis/types/unique_list.rb +1 -1
- data/lib/kredis/version.rb +1 -1
- data/lib/tasks/kredis/install.rake +6 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1cd3c7afcd05236cdb9ed3980d0969077f594da2fe1ca0be383610be4a4b37c
|
4
|
+
data.tar.gz: 912cd1ed2ff7d0b05df1fcacb07e0272ba098b86645a0607a80aa69e65107223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d7fa6004370d1d75c8b2567397ab88d65351af3d42d381cfc602d3db2a12eb10cdf0e42d190c802dea9d02fee112130cd6786ef60a125581924d82630191ebc
|
7
|
+
data.tar.gz: '07286763861b342cb8dd67c55f1df2e84d2496aa41a626bf23bd186ab7b8c698018cc7cb42bf65128cfb2a88eb22a9f73c84fa8a8a0516aaedb56d8c18624b19'
|
data/README.md
CHANGED
@@ -105,24 +105,24 @@ cycle.next # => GET mycycle + SET mycycle 0
|
|
105
105
|
:one == cycle.value # => GET mycycle
|
106
106
|
|
107
107
|
enum = Kredis.enum "myenum", values: %w[ one two three ], default: "one"
|
108
|
-
"one" == enum.value # => GET myenum
|
108
|
+
"one" == enum.value # => GET myenum
|
109
109
|
true == enum.one? # => GET myenum
|
110
110
|
enum.value = "two" # => SET myenum "two"
|
111
111
|
"two" == enum.value # => GET myenum
|
112
112
|
enum.value = "four"
|
113
113
|
"two" == enum.value # => GET myenum
|
114
114
|
enum.reset # => DEL myenum
|
115
|
-
"one" == enum.value # => GET myenum
|
115
|
+
"one" == enum.value # => GET myenum
|
116
116
|
|
117
117
|
slots = Kredis.slots "myslots", available: 3
|
118
118
|
true == slots.available? # => GET myslots
|
119
119
|
slots.reserve # => INCR myslots
|
120
120
|
true == slots.available? # => GET myslots
|
121
|
-
slots.reserve # => INCR myslots
|
121
|
+
slots.reserve # => INCR myslots
|
122
122
|
true == slots.available? # => GET myslots
|
123
123
|
slots.reserve # => INCR myslots
|
124
124
|
false == slots.available? # => GET myslots
|
125
|
-
slots.reserve # => INCR myslots + DECR myslots
|
125
|
+
slots.reserve # => INCR myslots + DECR myslots
|
126
126
|
false == slots.available? # => GET myslots
|
127
127
|
slots.release # => DECR myslots
|
128
128
|
true == slots.available? # => GET myslots
|
@@ -141,7 +141,7 @@ flag = Kredis.flag "myflag"
|
|
141
141
|
false == flag.marked? # => EXISTS myflag
|
142
142
|
flag.mark # => SET myflag 1
|
143
143
|
true == flag.marked? # => EXISTS myflag
|
144
|
-
flag.remove # => DEL myflag
|
144
|
+
flag.remove # => DEL myflag
|
145
145
|
false == flag.marked? # => EXISTS myflag
|
146
146
|
|
147
147
|
true == flag.mark(expires_in: 1.second, force: false) #=> SET myflag 1 EX 1 NX
|
@@ -196,26 +196,11 @@ end
|
|
196
196
|
|
197
197
|
1. Add the `kredis` gem to your Gemfile: `gem 'kredis'`
|
198
198
|
2. Run `./bin/bundle install`
|
199
|
-
3.
|
200
|
-
|
201
|
-
A default configuration can look like this for `config/redis/shared.yml`:
|
202
|
-
|
203
|
-
```yaml
|
204
|
-
production: &production
|
205
|
-
host: <%= ENV.fetch("REDIS_SHARED_HOST", "127.0.0.1") %>
|
206
|
-
port: <%= ENV.fetch("REDIS_SHARED_PORT", "6379") %>
|
207
|
-
timeout: 1
|
199
|
+
3. Run `./bin/rails kredis:install` to add a default configuration at [`config/redis/shared.yml`](lib/install/shared.yml)
|
208
200
|
|
209
|
-
|
210
|
-
host: <%= ENV.fetch("REDIS_SHARED_HOST", "127.0.0.1") %>
|
211
|
-
port: <%= ENV.fetch("REDIS_SHARED_PORT", "6379") %>
|
212
|
-
timeout: 1
|
213
|
-
|
214
|
-
test:
|
215
|
-
<<: *development
|
216
|
-
```
|
201
|
+
Additional configurations can be added under `config/redis/*.yml` and referenced when a type is created. For example, `Kredis.string("mystring", config: :strings)` would lookup `config/redis/strings.yml`.
|
217
202
|
|
218
|
-
|
203
|
+
Kredis passes the configuration to `Redis.new` to establish the connection. See the [Redis documentation](https://github.com/redis/redis-rb) for other configuration options.
|
219
204
|
|
220
205
|
### Setting SSL options on Redis Connections
|
221
206
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
production: &production
|
2
|
+
url: <%= ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379/0") %>
|
3
|
+
timeout: 1
|
4
|
+
|
5
|
+
development: &development
|
6
|
+
url: <%= ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379/0") %>
|
7
|
+
timeout: 1
|
8
|
+
|
9
|
+
# You can also specify host, port, and db instead of url
|
10
|
+
# host: <%= ENV.fetch("REDIS_SHARED_HOST", "127.0.0.1") %>
|
11
|
+
# port: <%= ENV.fetch("REDIS_SHARED_PORT", "6379") %>
|
12
|
+
# db: <%= ENV.fetch("REDIS_SHARED_DB", "11") %>
|
13
|
+
|
14
|
+
test:
|
15
|
+
<<: *development
|
data/lib/kredis/railtie.rb
CHANGED
@@ -7,7 +7,7 @@ class Kredis::Types::CallbacksProxy
|
|
7
7
|
Kredis::Types::Cycle => %i[ next ],
|
8
8
|
Kredis::Types::Enum => %i[ value= reset ],
|
9
9
|
Kredis::Types::Flag => %i[ mark remove ],
|
10
|
-
Kredis::Types::Hash => %i[ update delete ],
|
10
|
+
Kredis::Types::Hash => %i[ update delete []= remove ],
|
11
11
|
Kredis::Types::List => %i[ remove prepend append << ],
|
12
12
|
Kredis::Types::Scalar => %i[ value= clear ],
|
13
13
|
Kredis::Types::Set => %i[ add << remove replace take clear ],
|
data/lib/kredis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kredis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Timm Hansen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -61,6 +61,8 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- MIT-LICENSE
|
63
63
|
- README.md
|
64
|
+
- lib/install/install.rb
|
65
|
+
- lib/install/shared.yml
|
64
66
|
- lib/kredis.rb
|
65
67
|
- lib/kredis/attributes.rb
|
66
68
|
- lib/kredis/connections.rb
|
@@ -87,6 +89,7 @@ files:
|
|
87
89
|
- lib/kredis/types/slots.rb
|
88
90
|
- lib/kredis/types/unique_list.rb
|
89
91
|
- lib/kredis/version.rb
|
92
|
+
- lib/tasks/kredis/install.rake
|
90
93
|
homepage: https://github.com/rails/kredis
|
91
94
|
licenses:
|
92
95
|
- MIT
|
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: '0'
|
108
111
|
requirements: []
|
109
|
-
rubygems_version: 3.2.
|
112
|
+
rubygems_version: 3.2.30
|
110
113
|
signing_key:
|
111
114
|
specification_version: 4
|
112
115
|
summary: Higher-level data structures built on Redis.
|