Browse Source

docs(core): Document unit of TtlCache option

Michael Bromley 4 years ago
parent
commit
85051b8e37

+ 2 - 0
packages/core/src/common/ttl-cache.ts

@@ -1,6 +1,8 @@
 /**
  * An in-memory cache with a configurable TTL (time to live) which means cache items
  * expire after they have been in the cache longer than that time.
+ *
+ * The `ttl` config option is in milliseconds. Defaults to 30 seconds TTL and a cache size of 1000.
  */
 export class TtlCache<K, V> {
     private cache = new Map<K, { value: V; expires: number }>();

+ 1 - 1
packages/core/src/config/promotion/utils/facet-value-checker.ts

@@ -46,7 +46,7 @@ import { TransactionalConnection } from '../../../service/transaction/transactio
  * @docsCategory Promotions
  */
 export class FacetValueChecker {
-    private variantCache = new TtlCache<ID, ProductVariant>({ ttl: 5000 });
+    private variantCache = new TtlCache<ID, ProductVariant>({ ttlMs: 5000 });
 
     constructor(private connection: TransactionalConnection) {}
     /**