legion-cache 1.3.12 → 1.3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84f54b95a9a31607080afb2afbad2e85d713cb2d24b0a126dd97cea864d443a6
4
- data.tar.gz: 0be1410d11a82efb137f050b7236f6e7d8cde91d4d75cf1275c0ccc22fbc1ed7
3
+ metadata.gz: bb361d980bfc1761a6ea272c5225a1a1c33389ea8a15f87a1496354fb6f62390
4
+ data.tar.gz: f70347db3d1b7c2e849d7b31b3c456c992f776d9db0f16d801d1c0cb824160bb
5
5
  SHA512:
6
- metadata.gz: e581d3e4d49937215c091f309939985b174516a5fa78619e499bc5a2d01e6ac389c438fcf5bdc63d883ca72b08bc082e0926f88ffbc7fbae2578198ca6aad954
7
- data.tar.gz: a1618ccbad942d1c73bb0f549a6485f2883371b67d9bd3beded87aa58eb71bcdf092579c1d640afa80e3e98567c49e4e5cd6e4cd40f1bc0cf179ee188f219688
6
+ metadata.gz: 4b96a2ebb1066ace5026f7376e3c6e2788d9a744dd28e675d01e37539b02ad9cad5e18b9dd69172f2986b28742659b205d9e23708b0c1d0885a64149a1e80a4f
7
+ data.tar.gz: 4b45f7bc7d8ccca724d41e86899365db9ee08e1357052e70b46620752e0a91916f47372c33d11ae6ab38967c8f3ea028c2f25ee3687a29dfc0560bfb49e84f9b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.13] - 2026-03-24
4
+
5
+ ### Changed
6
+ - Reindex docs: update CLAUDE.md and README with Memory adapter and Helper mixin docs
7
+
3
8
  ## [1.3.12] - 2026-03-24
4
9
 
5
10
  ### Added
data/CLAUDE.md CHANGED
@@ -8,14 +8,14 @@
8
8
  Caching wrapper for the LegionIO framework. Provides a consistent interface for Memcached (via `dalli`) and Redis (via `redis` gem) with connection pooling. Driver selection is config-driven.
9
9
 
10
10
  **GitHub**: https://github.com/LegionIO/legion-cache
11
- **Version**: 1.3.0
11
+ **Version**: 1.3.12
12
12
  **License**: Apache-2.0
13
13
 
14
14
  ## Architecture
15
15
 
16
16
  ```
17
17
  Legion::Cache (singleton module)
18
- ├── .setup(**opts) # Connect to cache backend
18
+ ├── .setup(**opts) # Connect to cache backend (auto-detects LEGION_MODE=lite -> Memory adapter)
19
19
  ├── .get(key) # Retrieve cached value
20
20
  ├── .fetch(key, ttl) # Get with block/TTL support (Memcached only; alias for get on Redis)
21
21
  ├── .set(key, value, ttl) # Store value with optional TTL (positional on Memcached, keyword on Redis)
@@ -25,9 +25,10 @@ Legion::Cache (singleton module)
25
25
  ├── .size # Total pool connections
26
26
  ├── .available # Idle pool connections
27
27
  ├── .restart(**opts) # Close and reconnect pool with optional new opts
28
- ├── .shutdown # Close connections, mark disconnected
28
+ ├── .shutdown # Close connections, mark disconnected (handles Memory adapter)
29
29
  ├── .local # Accessor for Legion::Cache::Local
30
30
  ├── .using_local? # Whether fallback to local is active
31
+ ├── .using_memory? # Whether Memory adapter (lite mode) is active
31
32
 
32
33
  ├── Memcached # Dalli-based Memcached driver (default)
33
34
  │ └── Uses connection_pool for thread safety
@@ -35,6 +36,9 @@ Legion::Cache (singleton module)
35
36
  ├── Redis # Redis driver
36
37
  │ └── Uses connection_pool for thread safety
37
38
  │ └── Default pool_size is 20 (Memcached default is 10)
39
+ ├── Memory # Lite mode adapter: pure in-memory cache, TTL expiry, Mutex thread-safety
40
+ │ └── Activated by LEGION_MODE=lite env var; no Redis/Memcached required
41
+ ├── Helper # Injectable cache mixin for LEX extensions (namespaced cache_*/local_cache_*)
38
42
  ├── Local # Local cache tier (localhost Redis/Memcached, fallback target)
39
43
  │ ├── .setup # Connect to local cache server (auto-detect driver)
40
44
  │ ├── .shutdown # Close local connection
@@ -124,9 +128,11 @@ Dalli enforces a 1MB client-side limit by default (`value_max_bytes: 1_048_576`)
124
128
 
125
129
  | Path | Purpose |
126
130
  |------|---------|
127
- | `lib/legion/cache.rb` | Module entry, driver selection, setup/shutdown, fallback wiring |
131
+ | `lib/legion/cache.rb` | Module entry, driver selection, setup/shutdown, fallback wiring, Memory adapter activation |
128
132
  | `lib/legion/cache/memcached.rb` | Dalli/Memcached driver implementation |
129
133
  | `lib/legion/cache/redis.rb` | Redis driver implementation |
134
+ | `lib/legion/cache/memory.rb` | Lite mode Memory adapter: in-memory store with TTL + Mutex thread-safety |
135
+ | `lib/legion/cache/helper.rb` | Injectable cache mixin for LEX extensions |
130
136
  | `lib/legion/cache/local.rb` | Local cache tier (localhost, fallback target) |
131
137
  | `lib/legion/cache/pool.rb` | Connection pool management |
132
138
  | `lib/legion/cache/settings.rb` | Default configuration + local defaults |
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Caching wrapper for the [LegionIO](https://github.com/LegionIO/LegionIO) framework. Provides a consistent interface for Memcached (via `dalli`) and Redis (via `redis` gem) with connection pooling. Driver selection is config-driven.
4
4
 
5
- **Version**: 1.3.2
5
+ **Version**: 1.3.12
6
6
 
7
7
  ## Installation
8
8
 
@@ -40,6 +40,20 @@ Legion::Cache.flush # flushdb
40
40
  Legion::Cache.shutdown
41
41
  ```
42
42
 
43
+ ## Lite Mode (No Infrastructure)
44
+
45
+ When `LEGION_MODE=lite` is set, `Legion::Cache` activates the pure in-memory `Memory` adapter, bypassing Redis and Memcached entirely:
46
+
47
+ ```ruby
48
+ ENV['LEGION_MODE'] = 'lite'
49
+ Legion::Cache.setup
50
+ Legion::Cache.using_memory? # => true
51
+ Legion::Cache.set('key', 'value', 60)
52
+ Legion::Cache.get('key') # => 'value'
53
+ ```
54
+
55
+ The Memory adapter is thread-safe (Mutex), supports TTL expiry, and exposes the same `get`/`set`/`fetch`/`delete`/`flush` interface. Shutdown cleanly tears it down.
56
+
43
57
  ## Two-Tier Cache
44
58
 
45
59
  Legion::Cache supports a two-tier architecture: a shared remote cluster and a local per-machine cache. If the shared cluster is unreachable at setup, all operations transparently fall back to local.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Cache
5
- VERSION = '1.3.12'
5
+ VERSION = '1.3.13'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.12
4
+ version: 1.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity