You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Nested properties** - Dot notation like `target.@id`, `body.title.value`
359
+
360
+
**Protected Properties**: The system intelligently skips `__rerum` and `_id` fields during cache matching, as these are server-managed properties not present in user request bodies. This includes:
361
+
- Top-level: `__rerum`, `_id`
362
+
- Nested paths: `__rerum.history.next`, `target._id`, etc.
363
+
- Any position: starts with, contains, or ends with these protected property names
364
+
365
+
This conservative approach ensures cache invalidation is based only on user-controllable properties, preventing false negatives while maintaining correctness.
366
+
367
+
**Example with MongoDB Operators**:
368
+
```javascript
369
+
// Complex query with $or operator (common in Annotation queries)
Copy file name to clipboardExpand all lines: cache/docs/SHORT.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ The RERUM API now includes an intelligent caching layer that significantly impro
32
32
When you request data:
33
33
1.**First request**: Fetches from database, caches result, returns data (~300-800ms)
34
34
2.**Subsequent requests**: Returns cached data immediately (~1-5ms)
35
-
3.**After 5 minutes**: Cache expires, next request refreshes from database
35
+
3.**After TTL expires**: Cache entry removed, next request refreshes from database (default: 5 minutes, configurable up to 24 hours)
36
36
37
37
### For Write Operations
38
38
When you create, update, or delete objects:
@@ -95,7 +95,7 @@ Cache behavior can be adjusted via environment variables:
95
95
-`CACHING` - Enable/disable caching layer (default: `true`, set to `false` to disable)
96
96
-`CACHE_MAX_LENGTH` - Maximum entries (default: 1000)
97
97
-`CACHE_MAX_BYTES` - Maximum memory usage (default: 1GB)
98
-
-`CACHE_TTL` - Time-to-live in milliseconds (default: 300000 = 5 minutes)
98
+
-`CACHE_TTL` - Time-to-live in milliseconds (default: 300000 = 5 minutes, production often uses 86400000 = 24 hours)
99
99
100
100
**Note**: Limits are well-balanced for typical usage. With standard RERUM queries (100 items per page), 1000 cached entries use only ~26 MB (~2.7% of the 1GB byte limit). The byte limit serves as a safety net for edge cases.
0 commit comments