cacchern 0.0.7 → 0.0.8

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: 7da91fba0fdc2b574563c6a4d873c6dd8bdbf2013a9fb055a947a3d12c30d1c7
4
- data.tar.gz: 4df81dc4b764ddf13b332e5ce0c1e9188ef8d971a47667be111076b483f152fd
3
+ metadata.gz: cc688104a4bb96fe8edafc02543e17726a49a58fdaa1ec4022198041afd70beb
4
+ data.tar.gz: c5460219ba17347a25431b8801ead1fa5f59778b074fb5959901df4292014f76
5
5
  SHA512:
6
- metadata.gz: ff78a28a38c4b9ed3c157a18c8b44bce74f2aa24b043a93948ef087604a0db9d87cdd7e99a8e982f1131ee6bcf8d815a6ee5d3e93438e62fba072fd998110cdb
7
- data.tar.gz: 977c4f5251029840d80d036eebf3b4c9f321a7652bc5c96f34a86641ed20e637f04bb1455e4ac9e0c1c5e61354dded581e9d8c23e21be5b32a3294f4cfb3f596
6
+ metadata.gz: 8ffc74b06ef2770cae37143bf9724209dcbf1e001c32168a1522dc061de9b76a375a44de06ea2ab9990b885e83157205a67c00b9d6d33480095fc8deb3fd552c
7
+ data.tar.gz: 2f038b7fd4840dd77f7f9ac0ea415947a9d7a2f4986c8367218463b25295a4e84af4c3096974dab1babb6f7f8d4df34c34828c75b5a41d5435ac65652b5b948b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cacchern (0.0.7)
4
+ cacchern (0.0.8)
5
5
  activemodel
6
6
  activesupport
7
7
  redis (~> 4.0.0)
@@ -9,22 +9,23 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activemodel (5.2.3)
13
- activesupport (= 5.2.3)
14
- activesupport (5.2.3)
12
+ activemodel (6.0.0)
13
+ activesupport (= 6.0.0)
14
+ activesupport (6.0.0)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
16
  i18n (>= 0.7, < 2)
17
17
  minitest (~> 5.1)
18
18
  tzinfo (~> 1.1)
19
+ zeitwerk (~> 2.1, >= 2.1.8)
19
20
  ast (2.4.0)
20
21
  concurrent-ruby (1.1.5)
21
22
  database_cleaner (1.7.0)
22
23
  diff-lcs (1.3)
23
24
  dotenv (2.7.2)
24
- i18n (1.6.0)
25
+ i18n (1.7.0)
25
26
  concurrent-ruby (~> 1.0)
26
27
  jaro_winkler (1.5.2)
27
- minitest (5.11.3)
28
+ minitest (5.12.2)
28
29
  parallel (1.17.0)
29
30
  parser (2.6.3.0)
30
31
  ast (~> 2.4.0)
@@ -56,6 +57,7 @@ GEM
56
57
  tzinfo (1.2.5)
57
58
  thread_safe (~> 0.1)
58
59
  unicode-display_width (1.6.0)
60
+ zeitwerk (2.2.0)
59
61
 
60
62
  PLATFORMS
61
63
  ruby
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cacchern
2
2
 
3
- operate Redis like ActiveRecord interface
3
+ operate Redis with validation by ActiveModel
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,6 +20,47 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ - available classes
24
+ - Object(String)
25
+ - Set
26
+ - SortedSet
27
+
28
+ ### Object
29
+ `Cacchern::Object` is simple key-value class
30
+
31
+ 1. Create classes
32
+
33
+ Create class that overrides `Cacchern::Object`.
34
+
35
+ ```ruby
36
+ class Token < Cacchern::Object
37
+ validates :value, presence: true
38
+ end
39
+ ```
40
+
41
+ 2. Add value
42
+ ```ruby
43
+ Token.new(1, 'some token...').save
44
+ ```
45
+
46
+ If you want to save with ttl.
47
+
48
+ ```ruby
49
+ Token.new(1, 'some token...').save(expires_in: 1.hours)
50
+ ```
51
+
52
+ If you make raise `Error` with save, you can use `save!` method.
53
+
54
+ 3.Get value
55
+
56
+ ```ruby
57
+ token = Token.find(1)
58
+
59
+ print token.value # 'some token...'
60
+ ```
61
+
62
+ ### SortedSet
63
+
23
64
  1. Create classes
24
65
 
25
66
  Create class that overrides Cacchern::SortableMember
@@ -35,5 +35,13 @@ module Cacchern
35
35
  false
36
36
  end
37
37
  end
38
+
39
+ def remove(value)
40
+ Redis.current.srem @key, value.value
41
+ end
42
+
43
+ def remove_all
44
+ Redis.current.del @key
45
+ end
38
46
  end
39
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cacchern
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacchern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuhei TAKASUGI
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel