How to use the @algolia/cache-common.createNullCache function in @algolia/cache-common

To help you get started, we’ve selected a few @algolia/cache-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / algoliasearch-client-javascript / packages / client-analytics / src / createAnalyticsClient.ts View on Github external
> = options => {
  const region = options.region || 'us';
  const auth = createAuth(AuthMode.WithinHeaders, options.appId, options.apiKey);

  const transporter = createTransporter({
    ...options,
    // No retry strategy on recommendation client
    hostsCache: createNullCache(),
  });

  const appId = options.appId;

  transporter.setHosts([{ url: `analytics.${region}.algolia.com`, accept: CallEnum.Any }]);
  transporter.addHeaders({
    ...auth.headers(),
    ...{ 'content-type': 'application/json' },
  });
  transporter.addQueryParameters(auth.queryParameters());

  return addMethods({ appId, transporter }, options.methods);
};
github algolia / algoliasearch-client-javascript / packages / client-recommendation / src / createRecommendationClient.ts View on Github external
> = options => {
  const region = options.region || 'us';
  const auth = createAuth(AuthMode.WithinHeaders, options.appId, options.apiKey);

  const transporter = createTransporter({
    ...options,
    // No retry strategy on recommendation client
    hostsCache: createNullCache(),
  });

  const appId = options.appId;

  transporter.setHosts([{ url: `recommendation.${region}.algolia.com`, accept: CallEnum.Any }]);
  transporter.addHeaders({
    ...auth.headers(),
    ...{ 'content-type': 'application/json' },
  });
  transporter.addQueryParameters(auth.queryParameters());

  return addMethods({ appId, transporter }, options.methods);
};
github algolia / algoliasearch-client-javascript / packages / transporter / src / __tests__ / fixtures.ts View on Github external
transporter(requester: Requester, options: any = {}): Transporter {
      const transporter = algoliasearch('appId', 'apiKey').transporter;

      transporter.setHosts([
        { url: 'read.com', accept: CallEnum.Read },
        { url: 'write.com', accept: CallEnum.Write },
        { url: 'read-and-write.com', accept: CallEnum.Any },
      ]);

      return Object.assign(transporter, {
        requester,
        hostsCache: createInMemoryCache(),
        requestsCache: createNullCache(),
        responsesCache: createNullCache(),
        headers: {
          'X-Default-Header': 'Default value',
        },
        queryParameters: {},
        timeouts: {
          read: 2,
          write: 30,
          connect: 1,
        },
        ...options,
      });
    },
github algolia / algoliasearch-client-javascript / packages / transporter / src / __tests__ / fixtures.ts View on Github external
transporter(requester: Requester, options: any = {}): Transporter {
      const transporter = algoliasearch('appId', 'apiKey').transporter;

      transporter.setHosts([
        { url: 'read.com', accept: CallEnum.Read },
        { url: 'write.com', accept: CallEnum.Write },
        { url: 'read-and-write.com', accept: CallEnum.Any },
      ]);

      return Object.assign(transporter, {
        requester,
        hostsCache: createInMemoryCache(),
        requestsCache: createNullCache(),
        responsesCache: createNullCache(),
        headers: {
          'X-Default-Header': 'Default value',
        },
        queryParameters: {},
        timeouts: {
          read: 2,
          write: 30,
          connect: 1,
        },
        ...options,
      });
    },
github algolia / algoliasearch-client-javascript / packages / algoliasearch / src / builds / node.ts View on Github external
export default function algoliasearch(appId: string, apiKey: string): SearchClient {
  const clientOptions = {
    appId,
    apiKey,
    timeouts: {
      connect: 2,
      read: 5,
      write: 30,
    },
    requester: createNodeHttpRequester(),
    logger: createNullLogger(),
    responsesCache: createNullCache(),
    requestsCache: createNullCache(),
    hostsCache: createInMemoryCache(),
    userAgent: createUserAgent(version).add({
      segment: 'Node.js',
      version: process.versions.node,
    }),
  };

  return createSearchClient({
    ...clientOptions,
    methods: {
      search: multipleQueries,
      searchForFacetValues: multipleSearchForFacetValues,
      multipleBatch,
      multipleGetObjects,
      multipleQueries,
github algolia / algoliasearch-client-javascript / packages / algoliasearch / src / builds / node.ts View on Github external
export default function algoliasearch(appId: string, apiKey: string): SearchClient {
  const clientOptions = {
    appId,
    apiKey,
    timeouts: {
      connect: 2,
      read: 5,
      write: 30,
    },
    requester: createNodeHttpRequester(),
    logger: createNullLogger(),
    responsesCache: createNullCache(),
    requestsCache: createNullCache(),
    hostsCache: createInMemoryCache(),
    userAgent: createUserAgent(version).add({
      segment: 'Node.js',
      version: process.versions.node,
    }),
  };

  return createSearchClient({
    ...clientOptions,
    methods: {
      search: multipleQueries,
      searchForFacetValues: multipleSearchForFacetValues,
      multipleBatch,
      multipleGetObjects,
      multipleQueries,
      copyIndex,

@algolia/cache-common

Common interfaces for promise-based caching libraries

MIT
Latest version published 6 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages