lite-redis 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.fasterer.yml +19 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +30 -0
  6. data/.travis.yml +24 -0
  7. data/CHANGELOG.md +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +6 -0
  10. data/Gemfile.lock +135 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +108 -0
  13. data/Rakefile +8 -0
  14. data/_config.yml +1 -0
  15. data/bin/console +15 -0
  16. data/bin/setup +8 -0
  17. data/docs/CONNECTION.md +14 -0
  18. data/docs/GEO.md +14 -0
  19. data/docs/HASH.md +14 -0
  20. data/docs/HYPER_LOG_LOG.md +14 -0
  21. data/docs/KEY.md +14 -0
  22. data/docs/LIST.md +14 -0
  23. data/docs/PUB_SUB.md +31 -0
  24. data/docs/SCRIPT.md +14 -0
  25. data/docs/SET.md +14 -0
  26. data/docs/SORTED_SET.md +14 -0
  27. data/docs/STRING.md +14 -0
  28. data/docs/TRANSACTION.md +14 -0
  29. data/lib/generators/lite/redis/install_generator.rb +17 -0
  30. data/lib/generators/lite/redis/templates/install.rb +5 -0
  31. data/lib/lite/redis/base.rb +12 -0
  32. data/lib/lite/redis/configuration.rb +29 -0
  33. data/lib/lite/redis/connection.rb +12 -0
  34. data/lib/lite/redis/geo.rb +12 -0
  35. data/lib/lite/redis/hash.rb +12 -0
  36. data/lib/lite/redis/helpers/base_helper.rb +39 -0
  37. data/lib/lite/redis/helpers/connection_helper.rb +105 -0
  38. data/lib/lite/redis/helpers/geo_helper.rb +33 -0
  39. data/lib/lite/redis/helpers/hash_helper.rb +69 -0
  40. data/lib/lite/redis/helpers/hyper_log_log_helper.rb +21 -0
  41. data/lib/lite/redis/helpers/key_helper.rb +95 -0
  42. data/lib/lite/redis/helpers/list_helper.rb +133 -0
  43. data/lib/lite/redis/helpers/pub_sub_helper.rb +45 -0
  44. data/lib/lite/redis/helpers/script_helper.rb +21 -0
  45. data/lib/lite/redis/helpers/set_helper.rb +69 -0
  46. data/lib/lite/redis/helpers/sorted_set_helper.rb +136 -0
  47. data/lib/lite/redis/helpers/string_helper.rb +98 -0
  48. data/lib/lite/redis/helpers/transaction_helper.rb +29 -0
  49. data/lib/lite/redis/hyper_log_log.rb +12 -0
  50. data/lib/lite/redis/key.rb +12 -0
  51. data/lib/lite/redis/list.rb +12 -0
  52. data/lib/lite/redis/pub_sub.rb +12 -0
  53. data/lib/lite/redis/railtie.rb +16 -0
  54. data/lib/lite/redis/script.rb +12 -0
  55. data/lib/lite/redis/set.rb +12 -0
  56. data/lib/lite/redis/sorted_set.rb +12 -0
  57. data/lib/lite/redis/string.rb +12 -0
  58. data/lib/lite/redis/transaction.rb +12 -0
  59. data/lib/lite/redis/version.rb +9 -0
  60. data/lib/lite/redis.rb +16 -0
  61. data/lib/tasks/redis.rake +31 -0
  62. data/lite-redis.gemspec +53 -0
  63. metadata +272 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 96e8c6fe7c1589911dbab2b31a09662788087a69eca0c384e7cb72dbbf9465cd
4
+ data.tar.gz: 8faa2156ad8483ce1e65693bf77ef6794770df6d9c86729881399580cd7b67fc
5
+ SHA512:
6
+ metadata.gz: a2e9500d1ca7e07bd363128d79f11d1586344b70cba80cfd13f7248230f596a8b39051c33c088e62a83a3530ad5d35e7c79489a372837c90bb53d8e43e0814fc
7
+ data.tar.gz: 44660ee5b5e8257634f0d3dbb786ca4c53166609c01be56e275d0aba09071f5b251ebfe0ffda28cdc85159ecdf6956c29d5486930cb59987f638eae33ad60526
data/.fasterer.yml ADDED
@@ -0,0 +1,19 @@
1
+ speedups:
2
+ block_vs_symbol_to_proc: true
3
+ each_with_index_vs_while: false
4
+ fetch_with_argument_vs_block: true
5
+ for_loop_vs_each: true
6
+ getter_vs_attr_reader: true
7
+ gsub_vs_tr: true
8
+ hash_merge_bang_vs_hash_brackets: true
9
+ keys_each_vs_each_key: true
10
+ map_flatten_vs_flat_map: true
11
+ module_eval: true
12
+ proc_call_vs_yield: true
13
+ rescue_vs_respond_to: true
14
+ reverse_each_vs_reverse_each: true
15
+ select_first_vs_detect: true
16
+ select_last_vs_reverse_detect: true
17
+ setter_vs_attr_writer: true
18
+ shuffle_first_vs_sample: true
19
+ sort_vs_sort_by: true
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --backtrace
2
+ --color
3
+ --format progress
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,30 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+ AllCops:
5
+ TargetRubyVersion: 2.6
6
+ DisplayCopNames: true
7
+ DisplayStyleGuide: true
8
+ LineLength:
9
+ Max: 100
10
+ Layout/EmptyLinesAroundBlockBody:
11
+ Exclude:
12
+ - 'spec/**/**/*'
13
+ Layout/EmptyLinesAroundClassBody:
14
+ EnforcedStyle: empty_lines_except_namespace
15
+ Layout/EmptyLinesAroundModuleBody:
16
+ EnforcedStyle: empty_lines_except_namespace
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - 'spec/**/**/*'
20
+ - '*.gemspec'
21
+ RSpec/EmptyExampleGroup:
22
+ Enabled: false
23
+ RSpec/ExampleLength:
24
+ Enabled: false
25
+ RSpec/MultipleExpectations:
26
+ Enabled: false
27
+ Style/Documentation:
28
+ Enabled: false
29
+ Style/ExpandPathArguments:
30
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,24 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5
6
+ - 2.6
7
+ - ruby-head
8
+ matrix:
9
+ fast_finish: true
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ before_install:
13
+ - gem update --system
14
+ - gem install bundler
15
+ install:
16
+ - bundle install --jobs=3 --retry=3
17
+ script:
18
+ - bundle exec rspec
19
+ - bundle exec rubocop
20
+ # - bundle exec fasterer
21
+ notifications:
22
+ email: false
23
+ slack:
24
+ secure: WwODtp7ak8tiRluhld+pBvBcdiTUtDTqU7WayY8Hu3kHWa1JhjM858+JmCASRswEA15e1j0/Fe/HALsNVVaf5TnxEkA1jZuppulyzuiTzKWLyi52XYw6ZIkk3Bo+by/7s7ZpdcSLvLkurCr4zm1GidW6OMUsd4PPIvh395r+VOW+B2rmkTbitINvg6hlgHj1psJZo3HiB5Hn3Vv44oH/o7WDs1mEviTGjvG+56pez165iBY3Z7h/w0LlBdTp5858SBcesNW6f/SPsaQW5uc1O+50pbXeHor+jTXKdc4gfUrfn1K7eCS1xb+rsJzGLEfezXh0hnNc6fIxWi7RH84TwAtCCrhZL4ThZzOAIKuI7u3ivr50EwsaC6gM1cNsl1vXwgGyAVb9SSOqn0FNRrRPXO2IMTLFVdnvWBiciJ777OBSYsN4xEcqfbJfpBmBcnKhdQolor9QkJUjlUn7ThQUxbMcih34U0Q6/qcUhASXAeoQBmFS/VDoy9qqrnq/52fubR3W4UoYkMGeP7zizH0LSSNPWmiIXMubtg2ZGrmq4O2YilvvSJlBpbpIRKSjPXNHUgaaHTpaPF2CEklW2254Bvzer22oWebXUpNp30i965km7/xVUuz0XE9nJjNu2OljeTFxTu2YrA5DOt1P6/q2AVdtr6r+iMzvjh1PAa0sd4Q=
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+ ## [1.0.0] - 2019-07-08
9
+ ### Added
10
+ - Initial project version
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at j.gomez@drexed.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in lite-redis.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,135 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lite-redis (1.0.0)
5
+ redis
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (5.2.3)
11
+ actionview (= 5.2.3)
12
+ activesupport (= 5.2.3)
13
+ rack (~> 2.0)
14
+ rack-test (>= 0.6.3)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
+ actionview (5.2.3)
18
+ activesupport (= 5.2.3)
19
+ builder (~> 3.1)
20
+ erubi (~> 1.4)
21
+ rails-dom-testing (~> 2.0)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
23
+ activesupport (5.2.3)
24
+ concurrent-ruby (~> 1.0, >= 1.0.2)
25
+ i18n (>= 0.7, < 2)
26
+ minitest (~> 5.1)
27
+ tzinfo (~> 1.1)
28
+ ast (2.4.0)
29
+ builder (3.2.3)
30
+ colorize (0.8.1)
31
+ concurrent-ruby (1.1.5)
32
+ connection_pool (2.2.2)
33
+ crass (1.0.4)
34
+ diff-lcs (1.3)
35
+ erubi (1.8.0)
36
+ fakeredis (0.7.0)
37
+ redis (>= 3.2, < 5.0)
38
+ fasterer (0.6.0)
39
+ colorize (~> 0.7)
40
+ ruby_parser (>= 3.13.0)
41
+ generator_spec (0.9.4)
42
+ activesupport (>= 3.0.0)
43
+ railties (>= 3.0.0)
44
+ i18n (1.6.0)
45
+ concurrent-ruby (~> 1.0)
46
+ jaro_winkler (1.5.3)
47
+ loofah (2.2.3)
48
+ crass (~> 1.0.2)
49
+ nokogiri (>= 1.5.9)
50
+ method_source (0.9.2)
51
+ mini_portile2 (2.4.0)
52
+ minitest (5.11.3)
53
+ nokogiri (1.10.3)
54
+ mini_portile2 (~> 2.4.0)
55
+ parallel (1.17.0)
56
+ parser (2.6.3.0)
57
+ ast (~> 2.4.0)
58
+ rack (2.0.7)
59
+ rack-test (1.1.0)
60
+ rack (>= 1.0, < 3)
61
+ rails-dom-testing (2.0.3)
62
+ activesupport (>= 4.2.0)
63
+ nokogiri (>= 1.6)
64
+ rails-html-sanitizer (1.0.4)
65
+ loofah (~> 2.2, >= 2.2.2)
66
+ railties (5.2.3)
67
+ actionpack (= 5.2.3)
68
+ activesupport (= 5.2.3)
69
+ method_source
70
+ rake (>= 0.8.7)
71
+ thor (>= 0.19.0, < 2.0)
72
+ rainbow (3.0.0)
73
+ rake (12.3.2)
74
+ redis (4.1.2)
75
+ rspec (3.8.0)
76
+ rspec-core (~> 3.8.0)
77
+ rspec-expectations (~> 3.8.0)
78
+ rspec-mocks (~> 3.8.0)
79
+ rspec-core (3.8.2)
80
+ rspec-support (~> 3.8.0)
81
+ rspec-expectations (3.8.4)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.8.0)
84
+ rspec-mocks (3.8.1)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.8.0)
87
+ rspec-rails (3.8.2)
88
+ actionpack (>= 3.0)
89
+ activesupport (>= 3.0)
90
+ railties (>= 3.0)
91
+ rspec-core (~> 3.8.0)
92
+ rspec-expectations (~> 3.8.0)
93
+ rspec-mocks (~> 3.8.0)
94
+ rspec-support (~> 3.8.0)
95
+ rspec-support (3.8.2)
96
+ rubocop (0.72.0)
97
+ jaro_winkler (~> 1.5.1)
98
+ parallel (~> 1.10)
99
+ parser (>= 2.6)
100
+ rainbow (>= 2.2.2, < 4.0)
101
+ ruby-progressbar (~> 1.7)
102
+ unicode-display_width (>= 1.4.0, < 1.7)
103
+ rubocop-performance (1.4.0)
104
+ rubocop (>= 0.71.0)
105
+ rubocop-rspec (1.33.0)
106
+ rubocop (>= 0.60.0)
107
+ ruby-progressbar (1.10.1)
108
+ ruby_parser (3.13.1)
109
+ sexp_processor (~> 4.9)
110
+ sexp_processor (4.12.1)
111
+ thor (0.20.3)
112
+ thread_safe (0.3.6)
113
+ tzinfo (1.2.5)
114
+ thread_safe (~> 0.1)
115
+ unicode-display_width (1.6.0)
116
+
117
+ PLATFORMS
118
+ ruby
119
+
120
+ DEPENDENCIES
121
+ bundler
122
+ connection_pool
123
+ fakeredis
124
+ fasterer
125
+ generator_spec
126
+ lite-redis!
127
+ rake
128
+ rspec
129
+ rspec-rails
130
+ rubocop
131
+ rubocop-performance
132
+ rubocop-rspec
133
+
134
+ BUNDLED WITH
135
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Juan Gomez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # Lite::Redis
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/lite-redis.svg)](http://badge.fury.io/rb/lite-redis)
4
+ [![Build Status](https://travis-ci.org/drexed/lite-redis.svg?branch=master)](https://travis-ci.org/drexed/lite-redis)
5
+
6
+ Lite::Redis is a library for accessing Redis with an ActiveRecord like ORM interface.
7
+
8
+ **NOTE:** If you are coming from `ActiveRedisDB`, please read the [port](#port) section.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'lite-redis'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install lite-redis
25
+
26
+ ## Table of Contents
27
+
28
+ * [Configurations](#configurations)
29
+ * [Pooling](#pooling)
30
+ * [Commands](#commands)
31
+ * [Callers](#callers)
32
+ * [Port](#port)
33
+
34
+ ## Configurations
35
+
36
+ `rails g lite:redis:install` will generate the following file:
37
+ `../config/initalizers/lite-redis.rb`
38
+
39
+ ```ruby
40
+ Lite::Redis.configure do |config|
41
+ config.client = Redis.new
42
+ end
43
+ ```
44
+
45
+ ## Pooling
46
+
47
+ Use the [Connection Pool](https://github.com/mperham/connection_pool) gem to improve connection performance. Also look into [hiredis](https://github.com/redis/redis-rb#hiredis) driver to improve performance even further lists and ranges.
48
+
49
+ ```ruby
50
+ Lite::Redis.configure do |config|
51
+ config.client = ConnectionPool::Wrapper.new(size: 5, timeout: 5) { Redis.new }
52
+ end
53
+ ```
54
+
55
+ ## Commands
56
+
57
+ * [Connection](https://github.com/drexed/lite-redis/blob/master/docs/CONNECTION.md)
58
+ * [Geo](https://github.com/drexed/lite-redis/blob/master/docs/GEO.md)
59
+ * [Hash](https://github.com/drexed/lite-redis/blob/master/docs/HASH.md)
60
+ * [Hyper Log Log](https://github.com/drexed/lite-redis/blob/master/docs/HYPER_LOG_LOG.md)
61
+ * [Key](https://github.com/drexed/lite-redis/blob/master/docs/KEY.md)
62
+ * [List](https://github.com/drexed/lite-redis/blob/master/docs/LIST.md)
63
+ * [PubSub](https://github.com/drexed/lite-redis/blob/master/docs/PUB_SUB.md)
64
+ * [Script](https://github.com/drexed/lite-redis/blob/master/docs/SCRIPT.md)
65
+ * [Set](https://github.com/drexed/lite-redis/blob/master/docs/SET.md)
66
+ * [Sorted Set](https://github.com/drexed/lite-redis/blob/master/docs/SORTED_SET.md)
67
+ * [String](https://github.com/drexed/lite-redis/blob/master/docs/STRING.md)
68
+ * [Transaction](https://github.com/drexed/lite-redis/blob/master/docs/TRANSACTION.md)
69
+
70
+ ## Callers
71
+
72
+ There are two ways to access Redis commands, single class and multiple instance access.
73
+ Multiple instance access reuses a Redis connection for better performance.
74
+
75
+ ```ruby
76
+ # Single class access
77
+ Lite::Redis::String.create(:example, '123')
78
+ Lite::Redis::String.find(:example)
79
+
80
+ # - or -
81
+
82
+ # Multiple instance access
83
+ string = Lite::Redis::String.new
84
+ string.create(:example, '123')
85
+ string.find(:example)
86
+ ```
87
+
88
+ ## Port
89
+
90
+ `Lite::Redis` is a near compatible port of [ActiveRedisDB](https://github.com/drexed/active_redis_db).
91
+
92
+ ## Development
93
+
94
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
95
+
96
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
97
+
98
+ ## Contributing
99
+
100
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lite-redis. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
101
+
102
+ ## License
103
+
104
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
105
+
106
+ ## Code of Conduct
107
+
108
+ Everyone interacting in the Lite::Redis project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lite-redis/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-leap-day
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'lite/redis'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ # Connection
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/connection_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/connection_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ connection = Lite::Redis::Connection.new
11
+ connection.authenticate('pass') #=> 'OK'
12
+
13
+ Lite::Redis::Connection.connected? #=> true
14
+ ```
data/docs/GEO.md ADDED
@@ -0,0 +1,14 @@
1
+ # Geo
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/geo_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/geo_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ geo = Lite::Redis::Geo.new
11
+ geo.create('Sicily', 13.361389, 38.115556) #=> 1
12
+
13
+ Lite::Redis::Geo.position('Sicily', 'Catania') #=> [['15.08726745843887329', '37.50266842333162032']]
14
+ ```
data/docs/HASH.md ADDED
@@ -0,0 +1,14 @@
1
+ # Hash
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/hash_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/hash_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ hash = Lite::Redis::Hash.new
11
+ hash.create(:example, :name, 1)
12
+
13
+ Lite::Redis::Hash.find(:example, :name) #=> 1
14
+ ```
@@ -0,0 +1,14 @@
1
+ # HyperLogLog
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/hyper_log_log_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/hyper_log_log_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ hyper_log_log = Lite::Redis::HyperLogLog.new
11
+ hyper_log_log.create(:foo, 's1') #=> true
12
+
13
+ Lite::Redis::HyperLogLog.count(:foo) #=> 1
14
+ ```
data/docs/KEY.md ADDED
@@ -0,0 +1,14 @@
1
+ # Key
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/key_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/key_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ key = Lite::Redis::Key.new
11
+ key.create(:example, 'hello') #=> 'OK'
12
+
13
+ Lite::Redis::Key.exists?(:example) #=> true
14
+ ```
data/docs/LIST.md ADDED
@@ -0,0 +1,14 @@
1
+ # List
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/list_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/list_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ list = Lite::Redis::List.new
11
+ list.create(:example, 'one') #=> 'OK'
12
+
13
+ Lite::Redis::List.first(:example) #=> 'one'
14
+ ```
data/docs/PUB_SUB.md ADDED
@@ -0,0 +1,31 @@
1
+ # PubSub
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/pub_sub_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/pub_sub_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ pub_sub = Lite::Redis::PubSub.new
11
+ pub_sub.subscribe('foo') do |on|
12
+ on.subscribe do |channel, total|
13
+ @subscribed = true
14
+ @t1 = total
15
+ end
16
+
17
+ on.message do |channel, message|
18
+ if message == 's1'
19
+ r.unsubscribe
20
+ @message = message
21
+ end
22
+ end
23
+
24
+ on.unsubscribe do |channel, total|
25
+ @unsubscribed = true
26
+ @t2 = total
27
+ end
28
+ end
29
+
30
+ Lite::Redis::PubSub.subscribed? #=> true
31
+ ```
data/docs/SCRIPT.md ADDED
@@ -0,0 +1,14 @@
1
+ # Script
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/script_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/script_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ script = Lite::Redis::Script.new
11
+ script.script(:load, script) #=> 'OK'
12
+
13
+ Lite::Redis::Script.eval('return #KEYS') #=> 0
14
+ ```
data/docs/SET.md ADDED
@@ -0,0 +1,14 @@
1
+ # Set
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/set_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/set_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ set = Lite::Redis::Set.new
11
+ set.create(:example, '1') #=> 'OK'
12
+
13
+ Lite::Redis::Set.find(:example) #=> ['1']
14
+ ```
@@ -0,0 +1,14 @@
1
+ # Sorted Set
2
+
3
+ #### Usage
4
+
5
+ Please read the corresponding [helper](https://github.com/drexed/lite-redis/blob/master/lib/lite/redis/helpers/sorted_set_helper.rb) file to see all available methods.
6
+
7
+ Please read the corresponding [spec](https://github.com/drexed/lite-redis/blob/master/spec/lite/redis/sorted_set_spec.rb) file to see more example usages.
8
+
9
+ ```ruby
10
+ sorted_set = Lite::Redis::SortedSet.new
11
+ sorted_set.create(:example, 1, 1, 2, 'two', 3, '3') #=> 'OK'
12
+
13
+ Lite::Redis::SortedSet.find(:example, 2) #=> 'two'
14
+ ```