Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: config example function names #1107

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import {CacheClient, Configurations, CredentialProvider, CacheGet, SdkError, MomentoErrorCode} from '@gomomento/sdk';

/* eslint-disable @typescript-eslint/no-unused-vars */
async function configuration_ConstructWithNoConfig() {
async function example_configuration_ConstructWithNoConfig() {
const cacheClient = await CacheClient.create({
credentialProvider: CredentialProvider.fromEnvVar('MOMENTO_API_KEY'),
defaultTtlSeconds: 60,
Expand All @@ -20,7 +20,7 @@ async function configuration_ConstructWithNoConfig() {
/* eslint-enable @typescript-eslint/no-unused-vars */

/* eslint-disable @typescript-eslint/no-unused-vars */
async function configuration_ConstructWithLambdaConfig() {
async function example_configuration_ConstructWithLambdaConfig() {
const cacheClient = await CacheClient.create({
configuration: Configurations.Lambda.latest(),
credentialProvider: CredentialProvider.fromEnvVar('MOMENTO_API_KEY'),
Expand All @@ -29,7 +29,7 @@ async function configuration_ConstructWithLambdaConfig() {
}
/* eslint-enable @typescript-eslint/no-unused-vars */

async function configuration_ErrorHandlingHitMiss(cacheClient: CacheClient) {
async function example_configuration_ErrorHandlingHitMiss(cacheClient: CacheClient) {
const result = await cacheClient.get('test-cache', 'test-key');
if (result instanceof CacheGet.Hit) {
console.log(`Retrieved value for key 'test-key': ${result.valueString()}`);
Expand All @@ -43,7 +43,7 @@ async function configuration_ErrorHandlingHitMiss(cacheClient: CacheClient) {
}

/* eslint-disable @typescript-eslint/no-unused-vars */
async function configuration_ConstructWithThrowOnErrorsConfig() {
async function example_configuration_ConstructWithThrowOnErrorsConfig() {
const cacheClient = await CacheClient.create({
configuration: Configurations.Lambda.latest().withThrowOnErrors(true),
credentialProvider: CredentialProvider.fromEnvVar('MOMENTO_API_KEY'),
Expand All @@ -52,7 +52,7 @@ async function configuration_ConstructWithThrowOnErrorsConfig() {
}
/* eslint-enable @typescript-eslint/no-unused-vars */

async function configuration_ErrorHandlingExceptionErrorCode(cacheClient: CacheClient) {
async function example_configuration_ErrorHandlingExceptionErrorCode(cacheClient: CacheClient) {
try {
const result = await cacheClient.get('test-cache', 'test-key');
if (result instanceof CacheGet.Hit) {
Expand Down Expand Up @@ -81,18 +81,18 @@ async function main() {
defaultTtlSeconds: 60,
});

await configuration_ConstructWithNoConfig();
await configuration_ConstructWithLambdaConfig();
await configuration_ErrorHandlingHitMiss(cacheClient);
await configuration_ConstructWithThrowOnErrorsConfig();
await example_configuration_ConstructWithNoConfig();
await example_configuration_ConstructWithLambdaConfig();
await example_configuration_ErrorHandlingHitMiss(cacheClient);
await example_configuration_ConstructWithThrowOnErrorsConfig();

const cacheClientWithThrowOnErrors = await CacheClient.create({
configuration: Configurations.Lambda.latest().withThrowOnErrors(true),
credentialProvider: CredentialProvider.fromEnvVar('MOMENTO_API_KEY'),
defaultTtlSeconds: 60,
});

await configuration_ErrorHandlingExceptionErrorCode(cacheClientWithThrowOnErrors);
await example_configuration_ErrorHandlingExceptionErrorCode(cacheClientWithThrowOnErrors);
}

main().catch(e => {
Expand Down
Loading