legion-cache 1.3.14 → 1.3.16
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 +20 -2
- data/CHANGELOG.md +13 -0
- data/CLAUDE.md +1 -1
- data/README.md +2 -2
- data/lib/legion/cache/redis.rb +1 -1
- data/lib/legion/cache/version.rb +1 -1
- data/lib/legion/cache.rb +21 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b737f804b6327030853b50a1c0fb76a5a06c8c26219ae23a0c0ac767a8d62d53
|
|
4
|
+
data.tar.gz: 31d960c23bea1c3426c476cce67ce30cee27879b2f3b917fdf98e02aa4d5670a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1828c469b2d162eca345ca255e0489e98fee32249516552c922f56163c4066cb27364215b60a727af7c71b38f021f7d077107df826aadaafb95cbfd36ed04884
|
|
7
|
+
data.tar.gz: c4303cb9185f7d793fb4d383c690d7b48c90739a574ce2a03d0e1c93af6066cb62d6384738323336ccf3796c197cdd5f382b383e148537dafbccc165965d2670
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -3,6 +3,8 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches: [main]
|
|
5
5
|
pull_request:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '0 9 * * 1'
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
8
10
|
ci:
|
|
@@ -11,9 +13,25 @@ jobs:
|
|
|
11
13
|
needs-redis: true
|
|
12
14
|
needs-memcached: true
|
|
13
15
|
|
|
16
|
+
lint:
|
|
17
|
+
uses: LegionIO/.github/.github/workflows/lint-patterns.yml@main
|
|
18
|
+
|
|
19
|
+
security:
|
|
20
|
+
uses: LegionIO/.github/.github/workflows/security-scan.yml@main
|
|
21
|
+
|
|
22
|
+
version-changelog:
|
|
23
|
+
uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
|
|
24
|
+
|
|
25
|
+
dependency-review:
|
|
26
|
+
uses: LegionIO/.github/.github/workflows/dependency-review.yml@main
|
|
27
|
+
|
|
28
|
+
stale:
|
|
29
|
+
if: github.event_name == 'schedule'
|
|
30
|
+
uses: LegionIO/.github/.github/workflows/stale.yml@main
|
|
31
|
+
|
|
14
32
|
release:
|
|
15
|
-
needs: ci
|
|
33
|
+
needs: [ci, lint]
|
|
16
34
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
17
35
|
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
18
36
|
secrets:
|
|
19
|
-
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
|
37
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Accept ttl as positional or keyword argument in Cache.set for caller flexibility
|
|
7
|
+
- Align Redis.set signature to positional ttl arg matching parent module convention
|
|
8
|
+
|
|
9
|
+
## [1.3.15] - 2026-03-24
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- PHI-aware TTL enforcement: `Cache.set` accepts `phi: true` keyword option; TTL is capped at `cache.compliance.phi_max_ttl` (default 3600s) when set
|
|
13
|
+
- `Legion::Cache.phi_max_ttl` — reads `cache.compliance.phi_max_ttl` from settings with 3600s default
|
|
14
|
+
- `Legion::Cache.enforce_phi_ttl(ttl, phi:)` — public helper for PHI TTL cap logic
|
|
15
|
+
|
|
3
16
|
## [1.3.14] - 2026-03-24
|
|
4
17
|
|
|
5
18
|
### Added
|
data/CLAUDE.md
CHANGED
|
@@ -56,7 +56,7 @@ Legion::Cache (singleton module)
|
|
|
56
56
|
- **Driver Selection at Load Time**: `Legion::Settings[:cache][:driver]` determines which module gets `extend`ed into `Legion::Cache` (`'redis'` or `'dalli'`)
|
|
57
57
|
- **Connection Pooling**: Both drivers use `connection_pool` gem for thread-safe access
|
|
58
58
|
- **Unified Interface**: Same `get`/`set`/`delete`/`flush`/`connected?`/`shutdown` methods regardless of backend
|
|
59
|
-
- **TTL Signature
|
|
59
|
+
- **Uniform TTL Signature**: All backends use `set(key, value, ttl)` with a positional TTL argument (Memcached default 180s, Redis/Memory/Local default nil)
|
|
60
60
|
|
|
61
61
|
### Two-Tier Cache Architecture
|
|
62
62
|
|
data/README.md
CHANGED
|
@@ -31,8 +31,8 @@ Legion::Cache.fetch('foobar') # => 'testing' (get with block support)
|
|
|
31
31
|
Legion::Cache.delete('foobar') # => true
|
|
32
32
|
Legion::Cache.flush # flush all keys
|
|
33
33
|
|
|
34
|
-
# Redis driver — TTL is
|
|
35
|
-
Legion::Cache.set('foobar', 'testing',
|
|
34
|
+
# Redis driver — TTL is the third positional argument
|
|
35
|
+
Legion::Cache.set('foobar', 'testing', 10)
|
|
36
36
|
Legion::Cache.get('foobar') # => 'testing'
|
|
37
37
|
Legion::Cache.delete('foobar') # => true
|
|
38
38
|
Legion::Cache.flush # flushdb
|
data/lib/legion/cache/redis.rb
CHANGED
data/lib/legion/cache/version.rb
CHANGED
data/lib/legion/cache.rb
CHANGED
|
@@ -64,11 +64,28 @@ module Legion
|
|
|
64
64
|
super
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
def
|
|
68
|
-
return Legion::
|
|
69
|
-
return Legion::Cache::Local.set(key, value, ttl) if @using_local
|
|
67
|
+
def phi_max_ttl
|
|
68
|
+
return 3600 unless defined?(Legion::Settings)
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
Legion::Settings.dig(:cache, :compliance, :phi_max_ttl) || 3600
|
|
71
|
+
rescue StandardError
|
|
72
|
+
3600
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def enforce_phi_ttl(ttl, phi: false, **)
|
|
76
|
+
return ttl unless phi == true
|
|
77
|
+
|
|
78
|
+
max = phi_max_ttl
|
|
79
|
+
[ttl, max].min
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def set(key, value, ttl = nil, **opts)
|
|
83
|
+
ttl = opts.delete(:ttl) || ttl || 180
|
|
84
|
+
effective_ttl = enforce_phi_ttl(ttl, **opts)
|
|
85
|
+
return Legion::Cache::Memory.set(key, value, effective_ttl) if @using_memory
|
|
86
|
+
return Legion::Cache::Local.set(key, value, effective_ttl) if @using_local
|
|
87
|
+
|
|
88
|
+
super(key, value, effective_ttl)
|
|
72
89
|
end
|
|
73
90
|
|
|
74
91
|
def fetch(key, ttl = nil)
|