Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@aws-sdk/endpoint-cache
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/endpoint-cache/latest.svg)](https://www.npmjs.com/package/@aws-sdk/endpoint-cache) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/endpoint-cache.svg)](https://www.npmjs.com/package/@aws-sdk/e
@aws-sdk/endpoint-cache is a package that provides a caching mechanism for AWS SDK endpoints. It helps in reducing the number of endpoint resolution requests by caching the resolved endpoints, thus improving the performance of AWS SDK operations.
Creating an Endpoint Cache
This feature allows you to create an instance of the EndpointCache, which can be used to store and retrieve cached endpoints.
const { EndpointCache } = require('@aws-sdk/endpoint-cache');
const cache = new EndpointCache();
Adding an Endpoint to the Cache
This feature allows you to add an endpoint to the cache with a specified key and expiration time.
const endpoint = { address: 'https://example.com', expiration: Date.now() + 60000 };
cache.set('exampleKey', endpoint);
Retrieving an Endpoint from the Cache
This feature allows you to retrieve an endpoint from the cache using a specified key. If the endpoint is found and has not expired, it will be returned.
const cachedEndpoint = cache.get('exampleKey');
if (cachedEndpoint) {
console.log('Cached endpoint:', cachedEndpoint.address);
} else {
console.log('Endpoint not found in cache');
}
Deleting an Endpoint from the Cache
This feature allows you to delete an endpoint from the cache using a specified key.
cache.delete('exampleKey');
node-cache is a simple and fast Node.js internal caching module. It provides similar functionality to @aws-sdk/endpoint-cache by allowing you to store and retrieve cached data with expiration times. However, it is a more general-purpose caching solution and not specifically tailored for AWS SDK endpoints.
memory-cache is another general-purpose caching module for Node.js. It provides in-memory caching with support for time-to-live (TTL) and cache invalidation. Like node-cache, it is not specifically designed for AWS SDK endpoints but can be used for similar caching purposes.
cache-manager is a multi-store caching module for Node.js that supports various storage backends, including memory, Redis, and more. It offers more flexibility and scalability compared to @aws-sdk/endpoint-cache, but it is also more complex to set up and use.
An internal package
You probably shouldn't, at least directly.
mnemonist/lru-cache
for storing the cache.set
operation stores milliseconds elapsed since the UNIX epoch in Expires param based on CachePeriodInMinutes provided in Endpoint.get
operation returns all un-expired endpoints with their Expires values.getEndpoint
operation returns a randomly selected un-expired endpoint.3.52.0 (2022-02-18)
FAQs
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/endpoint-cache/latest.svg)](https://www.npmjs.com/package/@aws-sdk/endpoint-cache) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/endpoint-cache.svg)](https://www.npmjs.com/package/@aws-sdk/e
The npm package @aws-sdk/endpoint-cache receives a total of 1,739,114 weekly downloads. As such, @aws-sdk/endpoint-cache popularity was classified as popular.
We found that @aws-sdk/endpoint-cache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.