Commit 49b7540
Add Elasticsearch and Memcached storage adapters (#14)
* feat: add Elasticsearch storage adapter
Add a new @node-ts-cache/elasticsearch-storage package that provides
an Elasticsearch-based storage backend for caching. The implementation
uses the @elastic/elasticsearch v8 client and supports:
- Basic get/set/clear operations via IAsynchronousCacheType interface
- Pre-configured client injection for advanced use cases
- Automatic document cleanup with refresh-wait semantics
* feat: add Memcached storage adapter and update documentation
Add a new @node-ts-cache/memcached-storage package that provides
a Memcached-based storage backend for high-performance distributed
caching. The implementation uses the memcached package and supports:
- Basic get/set/clear operations via IAsynchronousCacheType interface
- Single server or multi-server distributed configuration
- Configurable connection options (retries, timeout, poolSize)
Also updates all documentation to include both Elasticsearch and
Memcached storage adapters in:
- Main README.md (packages table, architecture diagram, choosing guide)
- ts-cache/README.md (storage engines table)
- ts-cache/ADVANCED.md (detailed configuration examples)
* feat: add Valkey storage adapter and update documentation
Add a new @node-ts-cache/valkey-storage package that provides
a Valkey-based storage backend. Valkey is the open-source,
Redis-compatible fork backed by the Linux Foundation.
Features:
- Basic get/set/clear operations via IAsynchronousCacheType interface
- Batch operations via IMultiIAsynchronousCacheType interface
- Configurable TTL with maxAge option
- Error handler support for non-blocking writes
- Uses iovalkey client (ioredis-compatible)
Also updates all documentation to include Valkey storage adapter in:
- Main README.md (packages table, architecture diagram, choosing guide)
- ts-cache/README.md (storage engines table)
- ts-cache/ADVANCED.md (detailed configuration examples)
* Add Elasticsearch and Memcached storage adapters
This changeset introduces patch versions for the core and storage adapters, including Elasticsearch and Memcached.
* test: use mocks for storage adapter tests
Update tests for Elasticsearch, Memcached, and Redis storage adapters
to use mock clients instead of requiring real service connections.
This allows tests to run in CI without needing external services.
Changes:
- Elasticsearch: Add MockElasticsearchClient class for testing
- Memcached: Add client injection support and MockMemcached class
- Redis: Add client injection support and MockRedisClient class
All adapters now accept a pre-configured client in their options,
which enables easy mocking for tests while maintaining backward
compatibility for production use.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cea4fc3 commit 49b7540
26 files changed
Lines changed: 1589 additions & 52 deletions
File tree
- .changeset
- storages
- elasticsearch
- src
- test
- memcached
- src
- test
- redis
- src
- test
- valkey
- src
- test
- ts-cache
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
| |||
0 commit comments