UNPKG

@aws-amplify/core

Version:
1 lines 1.45 kB
{"version":3,"file":"cacheEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/cacheEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Cache } from '../../../Cache';\nimport { getCacheKey } from './getCacheKey';\n/**\n * Writes an endpoint id to a long-lived cache.\n *\n * @internal\n */\nexport const cacheEndpointId = async (appId, category, endpointId) => {\n const cacheKey = getCacheKey(appId, category);\n // Set a longer TTL to avoid endpoint id being deleted after the default TTL (3 days)\n // Also set its priority to the highest to reduce its chance of being deleted when cache is full\n const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years\n const expiration = new Date().getTime() + ttl;\n return Cache.setItem(cacheKey, endpointId, {\n expires: expiration,\n priority: 1,\n });\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,KAAK;AACtE,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD;AACA;AACA,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAClD,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;AAC/C,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,QAAQ,EAAE,CAAC;AACnB,KAAK,CAAC,CAAC;AACP;;;;"}