CloudflareDurableObjectStore class final
A sharded, SQLite-backed Store implemented with Durable Objects.
Each key is routed to a stable Durable Object name. Values are encoded as
JSON because the cache contracts intentionally accept arbitrary Dart
values. The same object also provides distributed locks, allowing
CacheRateLimiterBackend to perform its read-modify-write operation
atomically across Worker isolates.
SQLite-backed Durable Objects are available on the Workers Free plan. A small shard count avoids putting every cache key behind one globally hot object while keeping the number of Durable Object requests predictable.
Constructors
- CloudflareDurableObjectStore({required CloudflareDurableObjectNamespace namespace, String objectPrefix = 'routed-store', int shardCount = 16})
- Performs the CloudflareDurableObjectStore operation.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- objectPrefix → String
-
Prefix used when deriving Durable Object names.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
Number of independent Durable Object shards.
final
Methods
-
add(
String key, dynamic value, int seconds) → Future< bool> -
Stores an item in the cache only if
keyis absent (or expired). -
decrement(
String key, [int value = 1]) → Future< num> -
flush(
) → Future< bool> -
forever(
String key, dynamic value) → Future< bool> -
forget(
String key) → Future< bool> -
get(
String key) → Future -
getAllKeys(
) → Future< List< String> > -
getPrefix(
) → String -
increment(
String key, [int value = 1]) → Future< num> -
lock(
String name, [int seconds = 0, String? owner]) → Future< Lock> -
many(
List< String> keys) → Future<Map< String, dynamic> > -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, dynamic value, int seconds) → Future< bool> -
putMany(
Map< String, dynamic> values, int seconds) → Future<bool> -
restoreLock(
String name, String owner) → Future< Lock> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited