tiny-redis 0.0.8 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd6a84939fe1d2708c7002aadbb81ce0be8d80c89bcd5a004f27dd4a71bb7959
4
- data.tar.gz: 0e794200b037b8317420415445872a30964b285528514c62ded17d1b1d9a43ec
3
+ metadata.gz: 7d027f2a5a16f37ee213f2fb5bbf6cc9cfeab6e2f734c3982eca4a0cd4f357df
4
+ data.tar.gz: b8afbbedebb2c78b5497cc2f13dc2bc5d5757fe3b274b57f9c340857bf98c2bf
5
5
  SHA512:
6
- metadata.gz: 1e46955cce74ffe344565f059987446dd274bf9736290bb462a3348bb935c69670f22dac777364cb48679c6d84e6dc6379a035e49fc1b9a217d1f75e010f2ac8
7
- data.tar.gz: e1583b64114d166feefab1d59ad0df457ae6ed0c34307ad266328754781d4a9229ab39e3b7cb732debc3a8f477a904447b75ea20e2ec030122c7706bd7de2f6b
6
+ metadata.gz: 10a6cab1de4d76f20e9a53f9dbb22a3714c4444e3f806d1a72fd1454116b1415c2c040784f246879d7273713767a6f2ee429c8a2100ab47a66a8044176dca80a
7
+ data.tar.gz: 52dff9c8552d0cae2f87cbbffeb93342951f5a89e732f7397cedd51a4557c7bfd56faea9957a17f94d3bc8c162331e38a873d13c18c79691ce0c54f1f2b47fa6
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.8'
3
+ VERSION = '0.0.13'
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.8
4
+ version: 0.0.13
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