@@ -68,19 +68,17 @@ interface ShardedDOTagCacheOptions {
6868 numberOfHardReplicas : number ;
6969
7070 /**
71- * Whether to enable regional replication
72- * Regional replication will duplicate each shards and their associated replicas into every regions
73- * This will reduce the latency for the read operations
74- * On write, the write will be sent to all the shards and all the replicas in all the regions
75- * @default false
71+ * Enable regional replication for the shards.
72+ *
73+ * If not set, no regional replication will be performed and durable objects will be created without a location hint
74+ *
75+ * Can be used to reduce latency for users in different regions and to spread the load across multiple regions.
76+ *
77+ * This will increase the number of durable objects created, as each shard will be replicated in all regions.
7678 */
77- enableRegionalReplication ?: boolean ;
78-
79- /**
80- * Default region to use for the regional replication when the region cannot be determined
81- * @default "enam"
82- */
83- defaultRegion ?: AllowedDurableObjectRegion ;
79+ regionalReplicationOptions ?: {
80+ defaultRegion : AllowedDurableObjectRegion ;
81+ }
8482 } ;
8583
8684 /**
@@ -138,8 +136,8 @@ class ShardedDOTagCache implements NextModeTagCache {
138136 this . numSoftReplicas = opts . shardReplication ?. numberOfSoftReplicas ?? 1 ;
139137 this . numHardReplicas = opts . shardReplication ?. numberOfHardReplicas ?? 1 ;
140138 this . maxWriteRetries = opts . maxWriteRetries ?? DEFAULT_WRITE_RETRIES ;
141- this . enableRegionalReplication = opts . shardReplication ?. enableRegionalReplication ?? false ;
142- this . defaultRegion = opts . shardReplication ?. defaultRegion ?? DEFAULT_REGION ;
139+ this . enableRegionalReplication = Boolean ( opts . shardReplication ?. regionalReplicationOptions ) ;
140+ this . defaultRegion = opts . shardReplication ?. regionalReplicationOptions ?. defaultRegion ?? DEFAULT_REGION ;
143141 }
144142
145143 private getDurableObjectStub ( doId : DOId ) {
0 commit comments