cds-caching 3.0.0 → 3.1.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.
- package/README.md +2 -2
- package/db/statistics.cds +56 -0
- package/index.cds +5 -0
- package/lib/CachingService.d.ts +29 -0
- package/lib/CachingService.js +49 -0
- package/lib/config-normalizer.js +2 -0
- package/lib/operations/AsyncOperations.js +52 -24
- package/lib/operations/BasicOperations.js +6 -3
- package/lib/operations/CapOperations.js +59 -27
- package/lib/support/CacheStatisticsHandler.js +258 -13
- package/lib/support/RuntimeConfigurationManager.js +21 -1
- package/lib/support/StatisticsPersistenceManager.js +137 -4
- package/package.json +1 -1
- package/srv/caching-api-service.js +25 -1
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ class CachingApiService extends cds.ApplicationService {
|
|
|
19
19
|
// In MTX mode, lazily create cache entries on first dashboard / API access
|
|
20
20
|
// (skipped at startup because there's no tenant context)
|
|
21
21
|
if (isMultitenantMode()) {
|
|
22
|
-
this.before('READ', ['Caches', 'Metrics', 'KeyMetrics'], async () => {
|
|
22
|
+
this.before('READ', ['Caches', 'Metrics', 'KeyMetrics', 'TagMetrics'], async () => {
|
|
23
23
|
await this._ensureCacheEntries();
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -54,6 +54,21 @@ class CachingApiService extends cds.ApplicationService {
|
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
+
// Handle setTagMetricsEnabled action
|
|
58
|
+
this.on('setTagMetricsEnabled', async (req) => {
|
|
59
|
+
const { enabled } = req.data
|
|
60
|
+
const cacheService = await this._connectToCache(req);
|
|
61
|
+
const cache = this._cacheName(req);
|
|
62
|
+
try {
|
|
63
|
+
await cacheService.setTagMetricsEnabled(enabled)
|
|
64
|
+
req.info(`Tag metrics ${enabled ? 'enabled' : 'disabled'} for cache ${cache}`);
|
|
65
|
+
return true;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
req.error(`Failed to set tag metrics enabled: ${error.message}`);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
57
72
|
// Handle getCacheEntries function
|
|
58
73
|
this.on('getEntries', async (req) => {
|
|
59
74
|
const cacheService = await this._connectToCache(req);
|
|
@@ -137,6 +152,15 @@ class CachingApiService extends cds.ApplicationService {
|
|
|
137
152
|
return true;
|
|
138
153
|
});
|
|
139
154
|
|
|
155
|
+
// Handle clearTagMetrics action
|
|
156
|
+
this.on('clearTagMetrics', async (req) => {
|
|
157
|
+
const cacheService = await this._connectToCache(req);
|
|
158
|
+
const cache = this._cacheName(req);
|
|
159
|
+
await cacheService.clearTagMetrics();
|
|
160
|
+
req.info(`Tag metrics cleared successfully: ${cache}`);
|
|
161
|
+
return true;
|
|
162
|
+
});
|
|
163
|
+
|
|
140
164
|
// Handle clearMetrics action
|
|
141
165
|
this.on('clearMetrics', async (req) => {
|
|
142
166
|
const cacheService = await this._connectToCache(req);
|