Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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.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
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.