lex-memcached 0.1.3 → 0.2.0
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/.github/workflows/ci.yml +16 -0
- data/.rubocop.yml +40 -10
- data/CHANGELOG.md +13 -2
- data/CLAUDE.md +89 -0
- data/Dockerfile +1 -1
- data/Gemfile +4 -0
- data/Gemfile.lock +92 -59
- data/README.md +28 -20
- data/docker_deploy.rb +1 -0
- data/lex-memcached.gemspec +5 -4
- data/lib/legion/extensions/memcached/client.rb +28 -0
- data/lib/legion/extensions/memcached/helpers/client.rb +4 -2
- data/lib/legion/extensions/memcached/runners/item.rb +31 -25
- data/lib/legion/extensions/memcached/runners/server.rb +26 -20
- data/lib/legion/extensions/memcached/version.rb +3 -1
- data/lib/legion/extensions/memcached.rb +3 -0
- metadata +10 -25
- data/.github/workflows/rspec.yml +0 -54
- data/.github/workflows/rubocop.yml +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef636e82ef50dc51d08210bcd0039b93e3891cbe1ff445474900cd4fc38c36fc
|
|
4
|
+
data.tar.gz: '0918bc87ee94c952edb2620f53d333ca3e8cc715c4dbde23038a5796d6bc8e19'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2dd0aa8a44413bb8c83ffa56cc585e01427a438550f295fb08a3896b6c3903815705fba5e460880ffe075e52bf83604cbfd53a0ee00686066c4b9fa9ae1079e9
|
|
7
|
+
data.tar.gz: 5b9a55c1bcd10ece8bfa15b6abda60faeed6c6c4d19ad74889b5874a7141d8fab4d5eb2ff73943e4da64ffb471cee70a72f4b2f2cfccf8ebda68d36fed584c97
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ci:
|
|
9
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
|
|
11
|
+
release:
|
|
12
|
+
needs: ci
|
|
13
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
14
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
15
|
+
secrets:
|
|
16
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.rubocop.yml
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
1
6
|
Layout/LineLength:
|
|
2
|
-
Max:
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
|
+
EnforcedStyle: space
|
|
11
|
+
|
|
12
|
+
Layout/HashAlignment:
|
|
13
|
+
EnforcedHashRocketStyle: table
|
|
14
|
+
EnforcedColonStyle: table
|
|
15
|
+
|
|
3
16
|
Metrics/MethodLength:
|
|
4
|
-
Max:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
5
19
|
Metrics/ClassLength:
|
|
6
20
|
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
7
25
|
Metrics/BlockLength:
|
|
8
|
-
Max:
|
|
26
|
+
Max: 40
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'spec/**/*'
|
|
29
|
+
|
|
30
|
+
Metrics/AbcSize:
|
|
31
|
+
Max: 60
|
|
32
|
+
|
|
33
|
+
Metrics/CyclomaticComplexity:
|
|
34
|
+
Max: 15
|
|
35
|
+
|
|
36
|
+
Metrics/PerceivedComplexity:
|
|
37
|
+
Max: 17
|
|
38
|
+
|
|
9
39
|
Style/Documentation:
|
|
10
40
|
Enabled: false
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
41
|
+
|
|
42
|
+
Style/SymbolArray:
|
|
43
|
+
Enabled: true
|
|
44
|
+
|
|
15
45
|
Style/FrozenStringLiteralComment:
|
|
16
|
-
Enabled:
|
|
46
|
+
Enabled: true
|
|
47
|
+
EnforcedStyle: always
|
|
48
|
+
|
|
17
49
|
Naming/FileName:
|
|
18
50
|
Enabled: false
|
|
19
|
-
Style/ClassAndModuleChildren:
|
|
20
|
-
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-03-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Standalone `Client` class (`Legion::Extensions::Memcached::Client`) that includes all Runner modules (`Item`, `Server`), stores connection options, and provides a `client(**override)` method for creating `Dalli::Client` instances outside the full LegionIO framework
|
|
7
|
+
- Specs for the standalone `Client` class
|
|
8
|
+
|
|
9
|
+
## [0.1.3] - prior
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Initial implementation with `Item` and `Server` runners
|
|
13
|
+
- `Helpers::Client` wrapping `Dalli::Client`
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# lex-memcached: Memcached Integration for LegionIO
|
|
2
|
+
|
|
3
|
+
**Repository Level 3 Documentation**
|
|
4
|
+
- **Parent**: `/Users/miverso2/rubymine/legion/extensions-other/CLAUDE.md`
|
|
5
|
+
- **Grandparent**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Legion Extension that connects LegionIO to Memcached servers. Provides runners for item-level cache operations and server management through the Dalli client. Also includes a standalone `Client` class for use outside the Legion runtime.
|
|
10
|
+
|
|
11
|
+
**Version**: 0.2.0
|
|
12
|
+
|
|
13
|
+
**GitHub**: https://github.com/LegionIO/lex-memcached
|
|
14
|
+
**License**: MIT
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Legion::Extensions::Memcached
|
|
20
|
+
├── Client # Standalone client: includes all runners, manages Dalli connection
|
|
21
|
+
│ ├── (includes) Runners::Item
|
|
22
|
+
│ └── (includes) Runners::Server
|
|
23
|
+
├── Runners/
|
|
24
|
+
│ ├── Item # Cache item ops: set, get, fetch, add, delete, append
|
|
25
|
+
│ └── Server # Server management and stats
|
|
26
|
+
└── Helpers/
|
|
27
|
+
└── Client # Dalli client connection helper
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Key Files
|
|
31
|
+
|
|
32
|
+
| Path | Purpose |
|
|
33
|
+
|------|---------|
|
|
34
|
+
| `lib/legion/extensions/memcached.rb` | Entry point, extension registration |
|
|
35
|
+
| `lib/legion/extensions/memcached/client.rb` | Standalone client class: includes all runners, wraps Dalli connection |
|
|
36
|
+
| `lib/legion/extensions/memcached/runners/item.rb` | Item runner: set, get, fetch, add, delete, append |
|
|
37
|
+
| `lib/legion/extensions/memcached/runners/server.rb` | Server stats and management |
|
|
38
|
+
| `lib/legion/extensions/memcached/helpers/client.rb` | Dalli client factory |
|
|
39
|
+
|
|
40
|
+
## Runner: Item
|
|
41
|
+
|
|
42
|
+
| Method | Parameters |
|
|
43
|
+
|--------|-----------|
|
|
44
|
+
| `set` | `key:`, `value:`, `server:`, `ttl:` |
|
|
45
|
+
| `get` | `key:`, `server:` |
|
|
46
|
+
| `fetch` | `key:`, `server:` |
|
|
47
|
+
| `add` | `key:`, `value:`, `ttl:`, `server:` |
|
|
48
|
+
| `delete` | `key:`, `server:` |
|
|
49
|
+
| `append` | `key:`, `value:`, `server:` |
|
|
50
|
+
|
|
51
|
+
## Runner: Server
|
|
52
|
+
|
|
53
|
+
| Method | Parameters |
|
|
54
|
+
|--------|-----------|
|
|
55
|
+
| `alive` | `server:` |
|
|
56
|
+
| `flush` | `delay:` (default: 0), `server:` |
|
|
57
|
+
| `stats` | `delay:` (default: 0), `server:` |
|
|
58
|
+
| `reset_stats` | `server:` |
|
|
59
|
+
| `version` | `server:` |
|
|
60
|
+
|
|
61
|
+
## Standalone Usage
|
|
62
|
+
|
|
63
|
+
`Legion::Extensions::Memcached::Client` can be used independently of the Legion runtime. It accepts a `server:` kwarg (default: `'127.0.0.1:11211'`) and includes all Item and Server runner methods directly.
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
mc = Legion::Extensions::Memcached::Client.new(server: '10.0.0.1:11211')
|
|
67
|
+
mc.set(key: 'foo', value: 'bar', server: '10.0.0.1:11211', ttl: 300)
|
|
68
|
+
mc.get(key: 'foo', server: '10.0.0.1:11211')
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Per-call connection options can be overridden; the `client` method merges instance opts with any call-level overrides before building the `Dalli::Client`.
|
|
72
|
+
|
|
73
|
+
## Dependencies
|
|
74
|
+
|
|
75
|
+
| Gem | Purpose |
|
|
76
|
+
|-----|---------|
|
|
77
|
+
| `dalli` (>= 3.0) | Memcached Ruby client |
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
bundle install
|
|
83
|
+
bundle exec rspec
|
|
84
|
+
bundle exec rubocop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lex-memcached (0.
|
|
5
|
-
dalli
|
|
4
|
+
lex-memcached (0.2.0)
|
|
5
|
+
dalli (>= 3.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
amq-protocol (2.5.1)
|
|
13
|
+
ast (2.4.3)
|
|
14
|
+
aws-eventstream (1.4.0)
|
|
15
|
+
aws-sigv4 (1.12.1)
|
|
14
16
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
base64 (0.3.0)
|
|
18
|
+
bigdecimal (4.0.1)
|
|
19
|
+
bunny (2.24.0)
|
|
20
|
+
amq-protocol (~> 2.3)
|
|
17
21
|
sorted_set (~> 1, >= 1.0.2)
|
|
18
|
-
concurrent-ruby (1.
|
|
19
|
-
concurrent-ruby-ext (1.
|
|
20
|
-
concurrent-ruby (= 1.
|
|
21
|
-
connection_pool (2.
|
|
22
|
-
daemons (1.4.
|
|
23
|
-
dalli (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
concurrent-ruby (1.3.6)
|
|
23
|
+
concurrent-ruby-ext (1.3.6)
|
|
24
|
+
concurrent-ruby (= 1.3.6)
|
|
25
|
+
connection_pool (2.5.5)
|
|
26
|
+
daemons (1.4.1)
|
|
27
|
+
dalli (5.0.2)
|
|
28
|
+
logger
|
|
29
|
+
diff-lcs (1.6.2)
|
|
30
|
+
docile (1.4.1)
|
|
31
|
+
json (2.19.1)
|
|
32
|
+
json-schema (6.2.0)
|
|
33
|
+
addressable (~> 2.8)
|
|
34
|
+
bigdecimal (>= 3.1, < 5)
|
|
35
|
+
json_pure (2.8.1)
|
|
36
|
+
language_server-protocol (3.17.0.5)
|
|
27
37
|
legion-cache (1.2.0)
|
|
28
38
|
connection_pool (>= 2.2.3)
|
|
29
39
|
dalli (>= 2.7)
|
|
@@ -44,7 +54,7 @@ GEM
|
|
|
44
54
|
concurrent-ruby (>= 1.1.7)
|
|
45
55
|
legion-json
|
|
46
56
|
legion-settings
|
|
47
|
-
legionio (1.2.
|
|
57
|
+
legionio (1.2.1)
|
|
48
58
|
concurrent-ruby (>= 1.1.7)
|
|
49
59
|
concurrent-ruby-ext (>= 1.1.7)
|
|
50
60
|
daemons (>= 1.3.1)
|
|
@@ -58,60 +68,83 @@ GEM
|
|
|
58
68
|
oj (>= 3.10)
|
|
59
69
|
thor (>= 1)
|
|
60
70
|
lex-node (0.2.0)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
lint_roller (1.1.0)
|
|
72
|
+
logger (1.7.0)
|
|
73
|
+
mcp (0.8.0)
|
|
74
|
+
json-schema (>= 4.1)
|
|
75
|
+
multi_json (1.19.1)
|
|
76
|
+
net-http-persistent (4.0.8)
|
|
77
|
+
connection_pool (>= 2.2.4, < 4)
|
|
78
|
+
oj (3.16.16)
|
|
79
|
+
bigdecimal (>= 3.0)
|
|
80
|
+
ostruct (>= 0.2)
|
|
81
|
+
ostruct (0.6.3)
|
|
82
|
+
parallel (1.27.0)
|
|
83
|
+
parser (3.3.10.2)
|
|
65
84
|
ast (~> 2.4.1)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rspec
|
|
85
|
+
racc
|
|
86
|
+
prism (1.9.0)
|
|
87
|
+
public_suffix (7.0.5)
|
|
88
|
+
racc (1.8.1)
|
|
89
|
+
rainbow (3.1.1)
|
|
90
|
+
rake (13.3.1)
|
|
91
|
+
rbtree (0.4.6)
|
|
92
|
+
redis (5.4.1)
|
|
93
|
+
redis-client (>= 0.22.0)
|
|
94
|
+
redis-client (0.27.0)
|
|
95
|
+
connection_pool
|
|
96
|
+
regexp_parser (2.11.3)
|
|
97
|
+
rspec (3.13.2)
|
|
98
|
+
rspec-core (~> 3.13.0)
|
|
99
|
+
rspec-expectations (~> 3.13.0)
|
|
100
|
+
rspec-mocks (~> 3.13.0)
|
|
101
|
+
rspec-core (3.13.6)
|
|
102
|
+
rspec-support (~> 3.13.0)
|
|
103
|
+
rspec-expectations (3.13.5)
|
|
79
104
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
80
|
-
rspec-support (~> 3.
|
|
81
|
-
rspec-mocks (3.
|
|
105
|
+
rspec-support (~> 3.13.0)
|
|
106
|
+
rspec-mocks (3.13.8)
|
|
82
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
83
|
-
rspec-support (~> 3.
|
|
84
|
-
rspec-support (3.
|
|
85
|
-
rspec_junit_formatter (0.
|
|
108
|
+
rspec-support (~> 3.13.0)
|
|
109
|
+
rspec-support (3.13.7)
|
|
110
|
+
rspec_junit_formatter (0.6.0)
|
|
86
111
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
87
|
-
rubocop (1.
|
|
112
|
+
rubocop (1.85.1)
|
|
113
|
+
json (~> 2.3)
|
|
114
|
+
language_server-protocol (~> 3.17.0.2)
|
|
115
|
+
lint_roller (~> 1.1.0)
|
|
116
|
+
mcp (~> 0.6)
|
|
88
117
|
parallel (~> 1.10)
|
|
89
|
-
parser (>= 3.
|
|
118
|
+
parser (>= 3.3.0.2)
|
|
90
119
|
rainbow (>= 2.2.2, < 4.0)
|
|
91
|
-
regexp_parser (>=
|
|
92
|
-
|
|
93
|
-
rubocop-ast (>= 1.7.0, < 2.0)
|
|
120
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
121
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
94
122
|
ruby-progressbar (~> 1.7)
|
|
95
|
-
unicode-display_width (>=
|
|
96
|
-
rubocop-ast (1.
|
|
97
|
-
parser (>= 3.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
simplecov (0.
|
|
123
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
124
|
+
rubocop-ast (1.49.1)
|
|
125
|
+
parser (>= 3.3.7.2)
|
|
126
|
+
prism (~> 1.7)
|
|
127
|
+
ruby-progressbar (1.13.0)
|
|
128
|
+
simplecov (0.22.0)
|
|
101
129
|
docile (~> 1.1)
|
|
102
130
|
simplecov-html (~> 0.11)
|
|
103
131
|
simplecov_json_formatter (~> 0.1)
|
|
104
|
-
simplecov-html (0.
|
|
105
|
-
simplecov_json_formatter (0.1.
|
|
106
|
-
sorted_set (1.0
|
|
132
|
+
simplecov-html (0.13.2)
|
|
133
|
+
simplecov_json_formatter (0.1.4)
|
|
134
|
+
sorted_set (1.1.0)
|
|
107
135
|
rbtree
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
136
|
+
thor (1.5.0)
|
|
137
|
+
unicode-display_width (3.2.0)
|
|
138
|
+
unicode-emoji (~> 4.1)
|
|
139
|
+
unicode-emoji (4.2.0)
|
|
140
|
+
vault (0.20.0)
|
|
112
141
|
aws-sigv4
|
|
142
|
+
base64
|
|
143
|
+
connection_pool (~> 2.4)
|
|
144
|
+
net-http-persistent (~> 4.0, >= 4.0.2)
|
|
113
145
|
|
|
114
146
|
PLATFORMS
|
|
147
|
+
arm64-darwin-25
|
|
115
148
|
ruby
|
|
116
149
|
|
|
117
150
|
DEPENDENCIES
|
|
@@ -124,4 +157,4 @@ DEPENDENCIES
|
|
|
124
157
|
simplecov
|
|
125
158
|
|
|
126
159
|
BUNDLED WITH
|
|
127
|
-
2.
|
|
160
|
+
2.6.9
|
data/README.md
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lex-memcached
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
Memcached integration for [LegionIO](https://github.com/LegionIO/LegionIO). Run cache operations like get, set, add, append, and delete against Memcached servers via the Dalli client.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```ruby
|
|
12
|
-
gem 'legion-extensions-memcached'
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-memcached
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Or add to your Gemfile:
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'lex-memcached'
|
|
15
|
+
```
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
## Runners
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
| Runner | Methods |
|
|
20
|
+
|--------|---------|
|
|
21
|
+
| Item | `set`, `get`, `fetch`, `add`, `delete`, `append` |
|
|
22
|
+
| Server | Server management and stats |
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
### Item Parameters
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
| Method | Required | Optional |
|
|
27
|
+
|--------|----------|----------|
|
|
28
|
+
| `set` | `key`, `value` | `server`, `ttl` |
|
|
29
|
+
| `get` | `key` | `server` |
|
|
30
|
+
| `fetch` | `key` | `server` |
|
|
31
|
+
| `add` | `key`, `value`, `ttl` | `server` |
|
|
32
|
+
| `delete` | `key` | `server` |
|
|
33
|
+
| `append` | `key`, `value` | `server` |
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
## Requirements
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
- Ruby >= 3.4
|
|
38
|
+
- [LegionIO](https://github.com/LegionIO/LegionIO) framework
|
|
39
|
+
- Memcached server
|
|
32
40
|
|
|
33
|
-
##
|
|
41
|
+
## License
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
MIT
|
data/docker_deploy.rb
CHANGED
data/lex-memcached.gemspec
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
5
|
require 'legion/extensions/memcached/version'
|
|
@@ -11,13 +13,14 @@ Gem::Specification.new do |spec|
|
|
|
11
13
|
spec.summary = 'LEX::Memcached'
|
|
12
14
|
spec.description = 'LegionIO Extensions to connect to and manage memcached servers'
|
|
13
15
|
spec.homepage = 'https://github.com/LegionIO/lex-memcached'
|
|
14
|
-
spec.required_ruby_version =
|
|
16
|
+
spec.required_ruby_version = '>= 3.4'
|
|
15
17
|
|
|
16
18
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
17
19
|
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-memcached'
|
|
18
20
|
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-memcached'
|
|
19
21
|
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-memcached'
|
|
20
22
|
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-memcached/issues'
|
|
23
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
21
24
|
|
|
22
25
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
23
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
@@ -25,7 +28,5 @@ Gem::Specification.new do |spec|
|
|
|
25
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
29
|
spec.require_paths = ['lib']
|
|
27
30
|
|
|
28
|
-
spec.
|
|
29
|
-
|
|
30
|
-
spec.add_dependency 'dalli'
|
|
31
|
+
spec.add_dependency 'dalli', '>= 3.0'
|
|
31
32
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/item'
|
|
5
|
+
require_relative 'runners/server'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Memcached
|
|
10
|
+
class Client
|
|
11
|
+
include Runners::Item
|
|
12
|
+
include Runners::Server
|
|
13
|
+
|
|
14
|
+
attr_reader :opts
|
|
15
|
+
|
|
16
|
+
def initialize(server: '127.0.0.1:11211', **extra)
|
|
17
|
+
@opts = { server: server, **extra }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def client(**override)
|
|
21
|
+
merged = @opts.merge(override)
|
|
22
|
+
server = merged.fetch(:server)
|
|
23
|
+
Dalli::Client.new(server, **merged.except(:server))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'dalli'
|
|
2
4
|
|
|
3
5
|
module Legion
|
|
@@ -5,8 +7,8 @@ module Legion
|
|
|
5
7
|
module Memcached
|
|
6
8
|
module Helpers
|
|
7
9
|
module Client
|
|
8
|
-
def client(server: '127.0.0.1:11211', **
|
|
9
|
-
Dalli::Client.new(server, **
|
|
10
|
+
def client(server: '127.0.0.1:11211', **)
|
|
11
|
+
Dalli::Client.new(server, **)
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module Item
|
|
4
|
-
include Legion::Extensions::Memcached::Helpers::Client
|
|
5
|
-
|
|
6
|
-
def set(key:, value:, server: nil, **opts)
|
|
7
|
-
client(server: server, **opts).set(key, value, opts[:ttl])
|
|
8
|
-
{ success: true, key: key, value: value, server: server, **opts }
|
|
9
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
10
2
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Memcached
|
|
6
|
+
module Runners
|
|
7
|
+
module Item
|
|
8
|
+
include Legion::Extensions::Memcached::Helpers::Client
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
def set(key:, value:, server: nil, **opts)
|
|
11
|
+
client(server: server, **opts).set(key, value, opts[:ttl])
|
|
12
|
+
{ success: true, key: key, value: value, server: server, **opts }
|
|
13
|
+
end
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
def get(key:, server: nil, **)
|
|
16
|
+
{ success: true, get: client(server: server, **).get(key), **opts }
|
|
17
|
+
end
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
def fetch(key:, server: nil, **)
|
|
20
|
+
{ success: true, fetch: client(server: server, **).fetch(key), **opts }
|
|
21
|
+
end
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
def add(key:, value:, ttl:, server: nil, **)
|
|
24
|
+
{ success: true, add: client(server: server, **).add(key, value, ttl), **opts }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def delete(key:, server: nil, **)
|
|
28
|
+
{ success: true, delete: client(server: server, **).delete(key), **opts }
|
|
29
|
+
end
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
def append(key:, value:, server: nil, **)
|
|
32
|
+
{ success: true, append: client(server: server, **).append(key, value), **opts }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
include Legion::Extensions::Helpers::Lex
|
|
36
|
+
end
|
|
37
|
+
end
|
|
32
38
|
end
|
|
33
39
|
end
|
|
34
40
|
end
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
module Runners
|
|
3
|
-
module Server
|
|
4
|
-
include Legion::Extensions::Memcached::Helpers::Client
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Memcached
|
|
6
|
+
module Runners
|
|
7
|
+
module Server
|
|
8
|
+
include Legion::Extensions::Memcached::Helpers::Client
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
def alive(server: nil, **)
|
|
11
|
+
{ success: true, result: client(server: server, **).alive?, **opts }
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
def flush(delay: 0, server: nil, **opts)
|
|
15
|
+
{ success: true, result: Dalli::Client.new(server).flush(delay), **opts }
|
|
16
|
+
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
def stats(delay: 0, server: nil, **)
|
|
19
|
+
{ success: true, result: client(server: server, **).stats(delay), **opts }
|
|
20
|
+
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
def reset_stats(server: nil, **)
|
|
23
|
+
{ success: true, result: client(server: server, **).reset_stats, **opts }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def version(server: nil, **)
|
|
27
|
+
{ success: true, result: client(server: server, **).version, **opts }
|
|
28
|
+
end
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
include Legion::Extensions::Helpers::Lex
|
|
31
|
+
end
|
|
32
|
+
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
metadata
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-memcached
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: legionio
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
12
|
- !ruby/object:Gem::Dependency
|
|
28
13
|
name: dalli
|
|
29
14
|
requirement: !ruby/object:Gem::Requirement
|
|
30
15
|
requirements:
|
|
31
16
|
- - ">="
|
|
32
17
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
18
|
+
version: '3.0'
|
|
34
19
|
type: :runtime
|
|
35
20
|
prerelease: false
|
|
36
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
22
|
requirements:
|
|
38
23
|
- - ">="
|
|
39
24
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
25
|
+
version: '3.0'
|
|
41
26
|
description: LegionIO Extensions to connect to and manage memcached servers
|
|
42
27
|
email:
|
|
43
28
|
- matthewdiverson@gmail.com
|
|
@@ -45,12 +30,12 @@ executables: []
|
|
|
45
30
|
extensions: []
|
|
46
31
|
extra_rdoc_files: []
|
|
47
32
|
files:
|
|
48
|
-
- ".github/workflows/
|
|
49
|
-
- ".github/workflows/rubocop.yml"
|
|
33
|
+
- ".github/workflows/ci.yml"
|
|
50
34
|
- ".gitignore"
|
|
51
35
|
- ".rspec"
|
|
52
36
|
- ".rubocop.yml"
|
|
53
37
|
- CHANGELOG.md
|
|
38
|
+
- CLAUDE.md
|
|
54
39
|
- Dockerfile
|
|
55
40
|
- Gemfile
|
|
56
41
|
- Gemfile.lock
|
|
@@ -58,6 +43,7 @@ files:
|
|
|
58
43
|
- docker_deploy.rb
|
|
59
44
|
- lex-memcached.gemspec
|
|
60
45
|
- lib/legion/extensions/memcached.rb
|
|
46
|
+
- lib/legion/extensions/memcached/client.rb
|
|
61
47
|
- lib/legion/extensions/memcached/helpers/client.rb
|
|
62
48
|
- lib/legion/extensions/memcached/runners/item.rb
|
|
63
49
|
- lib/legion/extensions/memcached/runners/server.rb
|
|
@@ -70,7 +56,7 @@ metadata:
|
|
|
70
56
|
documentation_uri: https://github.com/LegionIO/lex-memcached
|
|
71
57
|
changelog_uri: https://github.com/LegionIO/lex-memcached
|
|
72
58
|
bug_tracker_uri: https://github.com/LegionIO/lex-memcached/issues
|
|
73
|
-
|
|
59
|
+
rubygems_mfa_required: 'true'
|
|
74
60
|
rdoc_options: []
|
|
75
61
|
require_paths:
|
|
76
62
|
- lib
|
|
@@ -78,15 +64,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
78
64
|
requirements:
|
|
79
65
|
- - ">="
|
|
80
66
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
67
|
+
version: '3.4'
|
|
82
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
69
|
requirements:
|
|
84
70
|
- - ">="
|
|
85
71
|
- !ruby/object:Gem::Version
|
|
86
72
|
version: '0'
|
|
87
73
|
requirements: []
|
|
88
|
-
rubygems_version: 3.
|
|
89
|
-
signing_key:
|
|
74
|
+
rubygems_version: 3.6.9
|
|
90
75
|
specification_version: 4
|
|
91
76
|
summary: LEX::Memcached
|
|
92
77
|
test_files: []
|
data/.github/workflows/rspec.yml
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: RSpec
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
rspec:
|
|
6
|
-
strategy:
|
|
7
|
-
fail-fast: false
|
|
8
|
-
matrix:
|
|
9
|
-
os: [ubuntu-latest]
|
|
10
|
-
ruby: [2.7]
|
|
11
|
-
runs-on: ${{ matrix.os }}
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: ruby/setup-ruby@v1
|
|
15
|
-
with:
|
|
16
|
-
ruby-version: ${{ matrix.ruby }}
|
|
17
|
-
bundler-cache: true
|
|
18
|
-
- name: RSpec run
|
|
19
|
-
run: |
|
|
20
|
-
bash -c "
|
|
21
|
-
bundle exec rspec
|
|
22
|
-
[[ $? -ne 2 ]]
|
|
23
|
-
"
|
|
24
|
-
rspec-mri:
|
|
25
|
-
needs: rspec
|
|
26
|
-
strategy:
|
|
27
|
-
fail-fast: false
|
|
28
|
-
matrix:
|
|
29
|
-
os: [ ubuntu-latest ]
|
|
30
|
-
ruby: [2.5, 2.6, '3.0', head]
|
|
31
|
-
runs-on: ${{ matrix.os }}
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v2
|
|
34
|
-
- uses: ruby/setup-ruby@v1
|
|
35
|
-
with:
|
|
36
|
-
ruby-version: ${{ matrix.ruby }}
|
|
37
|
-
bundler-cache: true
|
|
38
|
-
- run: bundle exec rspec
|
|
39
|
-
rspec-truffleruby:
|
|
40
|
-
needs: rspec
|
|
41
|
-
strategy:
|
|
42
|
-
fail-fast: false
|
|
43
|
-
matrix:
|
|
44
|
-
os: [ ubuntu-latest ]
|
|
45
|
-
ruby: [truffleruby]
|
|
46
|
-
runs-on: ${{ matrix.os }}
|
|
47
|
-
steps:
|
|
48
|
-
- uses: actions/checkout@v2
|
|
49
|
-
- uses: ruby/setup-ruby@v1
|
|
50
|
-
with:
|
|
51
|
-
ruby-version: ${{ matrix.ruby }}
|
|
52
|
-
bundler-cache: true
|
|
53
|
-
- run: bundle exec rspec
|
|
54
|
-
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
name: Rubocop
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
jobs:
|
|
4
|
-
rubocop:
|
|
5
|
-
strategy:
|
|
6
|
-
fail-fast: false
|
|
7
|
-
matrix:
|
|
8
|
-
os: [ubuntu-latest]
|
|
9
|
-
ruby: [2.7]
|
|
10
|
-
runs-on: ${{ matrix.os }}
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v2
|
|
13
|
-
- uses: ruby/setup-ruby@v1
|
|
14
|
-
with:
|
|
15
|
-
ruby-version: ${{ matrix.ruby }}
|
|
16
|
-
bundler-cache: true
|
|
17
|
-
- name: Install Rubocop
|
|
18
|
-
run: gem install rubocop code-scanning-rubocop
|
|
19
|
-
- name: Rubocop run --no-doc
|
|
20
|
-
run: |
|
|
21
|
-
bash -c "
|
|
22
|
-
rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
|
|
23
|
-
[[ $? -ne 2 ]]
|
|
24
|
-
"
|
|
25
|
-
- name: Upload Sarif output
|
|
26
|
-
uses: github/codeql-action/upload-sarif@v1
|
|
27
|
-
with:
|
|
28
|
-
sarif_file: rubocop.sarif
|