RedisCachePluginInitOptions) => `} />
+
+
+
+## RedisCachePluginInitOptions
+
+
+
+Configuration options for the RedisCachePlugin.
+
+```ts title="Signature"
+interface RedisCachePluginInitOptions {
+ maxItemSizeInBytes?: number;
+ namespace?: string;
+ redisOptions?: import('ioredis').RedisOptions;
+}
+```
+
+
+
+### maxItemSizeInBytes
+
+
+
+The maximum size of a single cache item in bytes. If a cache item exceeds this size, it will not be stored
+and an error will be logged.
+### namespace
+
+
+
+The namespace to use for all keys stored in Redis. This can be useful if you are sharing a Redis instance
+between multiple applications.
+### redisOptions
+
+
+
+Options to pass to the `ioredis` Redis client.
+
+
diff --git a/docs/docs/reference/typescript-api/cache/redis-cache-strategy.md b/docs/docs/reference/typescript-api/cache/redis-cache-strategy.md
index 67cee035c1..237e133a46 100644
--- a/docs/docs/reference/typescript-api/cache/redis-cache-strategy.md
+++ b/docs/docs/reference/typescript-api/cache/redis-cache-strategy.md
@@ -35,7 +35,7 @@ class RedisCacheStrategy implements CacheStrategy {
### constructor
- RedisCacheStrategy`} />
+RedisCachePluginInitOptions) => RedisCacheStrategy`} />
### init
@@ -55,7 +55,7 @@ class RedisCacheStrategy implements CacheStrategy {
### set
- Promise<void>`} />
+SetCacheKeyOptions) => Promise<void>`} />
### delete
diff --git a/docs/docs/reference/typescript-api/cache/sql-cache-strategy.md b/docs/docs/reference/typescript-api/cache/sql-cache-strategy.md
index d404f7d80f..fc615035ec 100644
--- a/docs/docs/reference/typescript-api/cache/sql-cache-strategy.md
+++ b/docs/docs/reference/typescript-api/cache/sql-cache-strategy.md
@@ -11,9 +11,10 @@ import MemberDescription from '@site/src/components/MemberDescription';
## SqlCacheStrategy
-
-
+
+A CacheStrategy that stores cached items in the database. This
+is the strategy used by the DefaultCachePlugin.
```ts title="Signature"
class SqlCacheStrategy implements CacheStrategy {
@@ -72,7 +73,7 @@ class SqlCacheStrategy implements CacheStrategy {
### set
- `} />
+SetCacheKeyOptions) => `} />
### delete
diff --git a/docs/docs/reference/typescript-api/entities/shipping-method.md b/docs/docs/reference/typescript-api/entities/shipping-method.md
index bb9c5b7fd4..aa9790e6e3 100644
--- a/docs/docs/reference/typescript-api/entities/shipping-method.md
+++ b/docs/docs/reference/typescript-api/entities/shipping-method.md
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
## ShippingMethod
-
+
A ShippingMethod is used to apply a shipping price to an Order. It is composed of a
ShippingEligibilityChecker and a ShippingCalculator. For a given Order,
@@ -40,6 +40,7 @@ class ShippingMethod extends VendureEntity implements ChannelAware, SoftDeletabl
customFields: CustomShippingMethodFields;
apply(ctx: RequestContext, order: Order) => Promise;
test(ctx: RequestContext, order: Order) => Promise;
+ toJSON() => any;
}
```
* Extends: VendureEntity
@@ -116,6 +117,11 @@ class ShippingMethod extends VendureEntity implements ChannelAware, SoftDeletabl
RequestContext, order: Order) => Promise<boolean>`} />
+### toJSON
+
+ any`} />
+
+
diff --git a/docs/docs/reference/typescript-api/shipping/check-shipping-eligibility-checker-fn.md b/docs/docs/reference/typescript-api/shipping/check-shipping-eligibility-checker-fn.md
index be2dfd238e..7037507efe 100644
--- a/docs/docs/reference/typescript-api/shipping/check-shipping-eligibility-checker-fn.md
+++ b/docs/docs/reference/typescript-api/shipping/check-shipping-eligibility-checker-fn.md
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
## CheckShippingEligibilityCheckerFn
-
+
A function which implements logic to determine whether a given Order is eligible for
a particular shipping method. Once a ShippingMethod has been assigned to an Order, this
diff --git a/docs/docs/reference/typescript-api/shipping/shipping-eligibility-checker.md b/docs/docs/reference/typescript-api/shipping/shipping-eligibility-checker.md
index e8ae9f3db5..fd1ac46cda 100644
--- a/docs/docs/reference/typescript-api/shipping/shipping-eligibility-checker.md
+++ b/docs/docs/reference/typescript-api/shipping/shipping-eligibility-checker.md
@@ -35,6 +35,7 @@ const minOrderTotalEligibilityChecker = new ShippingEligibilityChecker({
class ShippingEligibilityChecker extends ConfigurableOperationDef {
constructor(config: ShippingEligibilityCheckerConfig)
init(injector: Injector) => ;
+ toJSON() => ;
}
```
* Extends: ConfigurableOperationDef<T>
@@ -53,6 +54,11 @@ class ShippingEligibilityChecker extends Conf
Injector) => `} />
+### toJSON
+
+ `} />
+
+
diff --git a/docs/docs/reference/typescript-api/shipping/should-run-check-fn.md b/docs/docs/reference/typescript-api/shipping/should-run-check-fn.md
index 25128405e5..4fe208b577 100644
--- a/docs/docs/reference/typescript-api/shipping/should-run-check-fn.md
+++ b/docs/docs/reference/typescript-api/shipping/should-run-check-fn.md
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
## ShouldRunCheckFn
-
+
An optional method which is used to decide whether to run the `check()` function.
Returns a JSON-compatible object which is cached and compared between calls.
diff --git a/packages/core/src/config/system/cache-strategy.ts b/packages/core/src/config/system/cache-strategy.ts
index d680e5f935..8b0e65a6c1 100644
--- a/packages/core/src/config/system/cache-strategy.ts
+++ b/packages/core/src/config/system/cache-strategy.ts
@@ -5,6 +5,10 @@ import { InjectableStrategy } from '../../common/types/injectable-strategy';
/**
* @description
* Options available when setting the value in the cache.
+ *
+ * @since 3.1.0
+ * @docsCategory cache
+ * @docsPage CacheStrategy
*/
export interface SetCacheKeyOptions {
/**
@@ -30,8 +34,21 @@ export interface SetCacheKeyOptions {
* It is used by the {@link CacheService} to take care of storage and retrieval of items
* from the cache.
*
+ * If you are using the `DefaultCachePlugin` or the `RedisCachePlugin`, you will not need to
+ * manually specify a CacheStrategy, as these plugins will automatically configure the
+ * appropriate strategy.
+ *
+ * :::info
+ *
+ * This is configured via the `systemOptions.cacheStrategy` property of
+ * your VendureConfig.
+ *
+ * :::
+ *
* @since 3.1.0
* @docsCategory cache
+ * @docsPage CacheStrategy
+ * @docsWeight 0
*/
export interface CacheStrategy extends InjectableStrategy {
/**
diff --git a/packages/core/src/plugin/default-cache-plugin/default-cache-plugin.ts b/packages/core/src/plugin/default-cache-plugin/default-cache-plugin.ts
index e02731bb13..2356635b46 100644
--- a/packages/core/src/plugin/default-cache-plugin/default-cache-plugin.ts
+++ b/packages/core/src/plugin/default-cache-plugin/default-cache-plugin.ts
@@ -7,14 +7,25 @@ import { CacheTag } from './cache-tag.entity';
import { PLUGIN_INIT_OPTIONS } from './constants';
import { SqlCacheStrategy } from './sql-cache-strategy';
+/**
+ * @description
+ * Configuration options for the {@link DefaultCachePlugin}.
+ *
+ * @docsCategory cache
+ * @docsPage DefaultCachePlugin
+ * @since 3.1.0
+ */
export interface DefaultCachePluginInitOptions {
/**
* @description
* The maximum number of items to store in the cache. Once the cache reaches this size,
* the least-recently-used items will be evicted to make room for new items.
+ *
+ * @default 10_000
*/
cacheSize?: number;
/**
+ * @description
* Optionally provide a custom CacheTtlProvider to control the TTL of cache items.
* This is useful for testing.
*/
@@ -25,10 +36,13 @@ export interface DefaultCachePluginInitOptions {
* @description
* This plugin provides a simple SQL-based cache strategy {@link SqlCacheStrategy} which stores cached
* items in the database.
+ *
* It is suitable for production use (including multi-instance setups). For increased performance
* you can also consider using the {@link RedisCachePlugin}.
*
* @docsCategory cache
+ * @docsPage DefaultCachePlugin
+ * @docsWeight 0
* @since 3.1.0
*/
@VendurePlugin({
diff --git a/packages/core/src/plugin/default-cache-plugin/sql-cache-strategy.ts b/packages/core/src/plugin/default-cache-plugin/sql-cache-strategy.ts
index 09bee0df4e..04d13c78e9 100644
--- a/packages/core/src/plugin/default-cache-plugin/sql-cache-strategy.ts
+++ b/packages/core/src/plugin/default-cache-plugin/sql-cache-strategy.ts
@@ -10,7 +10,9 @@ import { CacheItem } from './cache-item.entity';
import { CacheTag } from './cache-tag.entity';
/**
- * A {@link CacheStrategy} that stores cached items in the database.
+ * @description
+ * A {@link CacheStrategy} that stores cached items in the database. This
+ * is the strategy used by the {@link DefaultCachePlugin}.
*
* @since 3.1.0
* @docsCategory cache
diff --git a/packages/core/src/plugin/redis-cache-plugin/redis-cache-plugin.ts b/packages/core/src/plugin/redis-cache-plugin/redis-cache-plugin.ts
index 787b61fae3..4029488e84 100644
--- a/packages/core/src/plugin/redis-cache-plugin/redis-cache-plugin.ts
+++ b/packages/core/src/plugin/redis-cache-plugin/redis-cache-plugin.ts
@@ -12,6 +12,8 @@ import { RedisCachePluginInitOptions } from './types';
* replacement for the {@link DefaultCachePlugin}.
*
* @docsCategory cache
+ * @docsPage RedisCachePlugin
+ * @docsWeight 0
* @since 3.1.0
*/
@VendurePlugin({
diff --git a/packages/core/src/plugin/redis-cache-plugin/types.ts b/packages/core/src/plugin/redis-cache-plugin/types.ts
index 8ef39fbdb4..f5cdaad2a4 100644
--- a/packages/core/src/plugin/redis-cache-plugin/types.ts
+++ b/packages/core/src/plugin/redis-cache-plugin/types.ts
@@ -1,5 +1,11 @@
-import { CacheTtlProvider } from '../../cache/cache-ttl-provider';
-
+/**
+ * @description
+ * Configuration options for the {@link RedisCachePlugin}.
+ *
+ * @docsCategory cache
+ * @docsPage RedisCachePlugin
+ * @since 3.1.0
+ */
export interface RedisCachePluginInitOptions {
/**
* @description
@@ -9,6 +15,17 @@ export interface RedisCachePluginInitOptions {
* @default 128kb
*/
maxItemSizeInBytes?: number;
+ /**
+ * @description
+ * The namespace to use for all keys stored in Redis. This can be useful if you are sharing a Redis instance
+ * between multiple applications.
+ *
+ * @default 'vendure-cache'
+ */
namespace?: string;
+ /**
+ * @description
+ * Options to pass to the `ioredis` Redis client.
+ */
redisOptions?: import('ioredis').RedisOptions;
}