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
CacheSync uses message providers from Qified to broadcast cache operations (SET and DELETE) to all connected cache instances. Each instance subscribes to these events and automatically updates its local storage when receiving updates from other instances.
368
+
`CacheableSync` uses message providers from Qified to broadcast cache operations (SET and DELETE) to all connected cache instances. Each instance subscribes to these events and automatically updates its `primary` (example: in-memory) storage when receiving updates from other instances.
369
369
370
370
## Supported Message Providers
371
371
372
-
CacheSync supports all Qified message providers including:
1.**SET Operations**: When you call `cache.set()` or `cache.setMany()`, the cache:
470
-
- Updates the local primary storage
448
+
- Updates the local primary storage and secondary storage
471
449
- Publishes a `cache:set` event with the key, value, ttl, and cacheId
472
-
- Other cache instances receive the event and update their local storage (excluding the originating instance)
450
+
- Other cache instances receive the event and update their `primary` storage (excluding the originating instance)
473
451
474
452
2.**DELETE Operations**: When you call `cache.delete()` or `cache.deleteMany()`, the cache:
475
-
- Removes the key from local primary storage
453
+
- Removes the key from primary and secondary storage
476
454
- Publishes a `cache:delete` event with the key and cacheId
477
455
- Other cache instances receive the event and remove the key from their storage
478
456
479
-
3.**Instance Filtering**: Each cache instance has a unique `cacheId`. Events are only applied if they come from a different instance, preventing infinite loops.
480
-
481
457
## Important Notes
482
458
483
-
* Cache sync only works with the **primary storage layer**. Secondary storage is not synchronized.
484
-
* Each cache instance should have a unique `cacheId` to properly filter sync events.
459
+
* Cache sync only works with the **primary storage layer**. Secondary storage is usually handled by the instance doing the initial work.
460
+
* Each cache instance should have a unique `cacheId` to properly filter sync events. This is setup by default but you can set it if you want.
485
461
* Sync events are **eventually consistent** - there may be a small delay between when a value is set and when it appears in other instances.
486
-
* The sync feature requires a message provider to be running and accessible by all cache instances.
462
+
* The sync feature requires a message provider to be running and accessible by all cache instances.
463
+
* Each cache instance has a unique `cacheId`. Events are only applied if they come from a different instance, preventing infinite loops.
0 commit comments