cacchern 0.0.7 → 0.0.8
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 +4 -4
- data/Gemfile.lock +8 -6
- data/README.md +42 -1
- data/lib/cacchern/set.rb +8 -0
- data/lib/cacchern/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc688104a4bb96fe8edafc02543e17726a49a58fdaa1ec4022198041afd70beb
|
4
|
+
data.tar.gz: c5460219ba17347a25431b8801ead1fa5f59778b074fb5959901df4292014f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ffc74b06ef2770cae37143bf9724209dcbf1e001c32168a1522dc061de9b76a375a44de06ea2ab9990b885e83157205a67c00b9d6d33480095fc8deb3fd552c
|
7
|
+
data.tar.gz: 2f038b7fd4840dd77f7f9ac0ea415947a9d7a2f4986c8367218463b25295a4e84af4c3096974dab1babb6f7f8d4df34c34828c75b5a41d5435ac65652b5b948b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cacchern (0.0.
|
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 (
|
13
|
-
activesupport (=
|
14
|
-
activesupport (
|
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.
|
25
|
+
i18n (1.7.0)
|
25
26
|
concurrent-ruby (~> 1.0)
|
26
27
|
jaro_winkler (1.5.2)
|
27
|
-
minitest (5.
|
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
|
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
|
data/lib/cacchern/set.rb
CHANGED
data/lib/cacchern/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|