tiny-redis 0.0.9 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65c3a42f95ace511ed4e25d88a7608629d808fcdb902eb9278439245078b5160
4
- data.tar.gz: b0898e7083524055eba33c6a41c8e6244597ef0119020d85b392cd3dfb5b96cf
3
+ metadata.gz: 918f94d1b08f82aa6f060ae16cc3c97b6bbb11193ab07aa2716269712af1552d
4
+ data.tar.gz: b30a59ebd5df985b7a7a06c7e23c13e9d35719aeb49f1f33ae2d7f43c3ad7849
5
5
  SHA512:
6
- metadata.gz: 67d817304d3498ba25679fa972997bd00b54f980f6d790d369d6928f96e83c98f2132de2043bfeeea059d76f7049ee8c738de091c7d77d0e64b12bd878b8871d
7
- data.tar.gz: 8e0c494f8a872703a2619fd17277184ad0d9ae92c4004a32eddbb826020b47c116e4d7acbb6702929eae8d3af1992ea51ebc9d2eef98e8c88601c3759b396c95
6
+ metadata.gz: 2be38b1337f852082f19b5e2c369272ad99cc6384737216bdf588f718d8dab3d0f7cc6d044f92e97534ed402dce80777f007312c9c9355d75fef1e11509b1fbe
7
+ data.tar.gz: 2693fdf6e11e657aa775a2c847dc663dbefaaec81d8f27e7f8fc6dbdfc68ae822cd3a65936e3c51c58aa6ee1bf4aa8ddee0a100a08dc84a34537f5cae1066cec
data/README.md CHANGED
@@ -19,7 +19,7 @@ Steps to use:
19
19
 
20
20
  ```
21
21
  class User
22
- include TinyRedis
22
+ include Tiny::Redis
23
23
 
24
24
  attr_accessor :email
25
25
  alias_method :index, :email # this will tie your records method to indexing parameter
@@ -33,6 +33,12 @@ Set up credentials:
33
33
  user:
34
34
  encryptkey: abcdabcdabcdadbvabcdabcdabcdadbv
35
35
  ```
36
+ ##Env Vars
37
+ ```
38
+ RAILS_MAX_CONCURRENCY - how many connections will be created to redis server
39
+ REDIS_TIMEOUT - timeout for operations
40
+ REDIS_URL - url for redis server.
41
+ ```
36
42
 
37
43
  Now your records in redis are encrypted. If you wish for more security you can remove config/master.key after server starts. And investigate SE Linux address space protection so hacker can't pry encryption key from the app so easily.
38
44
 
@@ -0,0 +1,22 @@
1
+ class TinyRedisGenerator < Rails::Generators::Base
2
+ def create_tiny_redis_file
3
+ create_file "config/initializers/tiny-redis.rb", <<EOD
4
+ concurrency = Env.fetch(:RAILS_MAX_CONCURRENCY) {5}
5
+ timeout = Env.fetch(:REDIS_TIMEOUT) {1}
6
+ url = Env.fetch(:REDIS_URL){
7
+ if Rails.env.test?
8
+ "redis://127.0.0.1:6379/2"
9
+ else
10
+ "redis://127.0.0.1:6379/1"
11
+ end
12
+ }
13
+
14
+ if Rails.env.test?
15
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url )}
16
+ $redis.flushall
17
+ else
18
+ $redis = ConnectionPool::Wrapper.new(size: concurrency, timeout: timeout) { Redis.new(url: url )}
19
+ end
20
+ EOD
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Tiny
2
2
  module Redis
3
- VERSION = '0.0.9'
3
+ VERSION = '0.0.14'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Zaitsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-27 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -68,6 +68,7 @@ files:
68
68
  - MIT-LICENSE
69
69
  - README.md
70
70
  - Rakefile
71
+ - lib/generators/tiny_redis_generator.rb
71
72
  - lib/tasks/tiny/redis_tasks.rake
72
73
  - lib/tiny/redis.rb
73
74
  - lib/tiny/redis/railtie.rb