
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@level-two/redis
Advanced tools
A message broker and cache extension for LevelTwo. Refer to the Worker API for function definitions.
import { createLevelTwoRedis } from "@level-two/redis";
// Integrates redis pubsub & cache into a LevelTwo instance
const levelTwo = createLevelTwoRedis({
clientOptions: { url: "redis://localhost:6379" },
});
// Create a worker for getting cacheable customer objects
const worker = levelTwo.createWorker("customer", async (ids, earlyWrite) => {
const rows = await mysql.query(
"SELECT id, name FROM customers WHERE id IN (?)",
[ids]
);
rows.forEach((row) => earlyWrite(row.id, row));
});
// Service method for getting a single customer
export async function getCustomer(id: string): Promise<Customer> {
return await worker.get(id);
}
// Service method for getting a list of customers
export async function getCustomerList(ids: string[]): Promise<Customer[]> {
return await worker.getMulti(ids);
}
redis
Existing redis client that should be used in this extension
clientOptions
Configuration options for creating a new redis client
broadcastChannel
Broadcast channel name for sending/receiving actions. Defaults to "level-two-broadcast"
cachePrefix
String prefix to use in front of each cache key
cacheDisabled
Indicates if cache should be disabled or not. Defaults to enabled
cacheDefaults
LevelTwo worker cache defaults
v2.0.0
Starting with version 2.0.0
: Iterable, peek
, peekMulti
, values
, entries
, forEach
all return CachedEntry
wrapped result values instead of the ResultValue
directly.
Switching to a wrapped CachedEntry
will allow for current and future expansion on utilities for metric tracking of entries.
FAQs
Redis message broker and cache extension of LevelTwo
The npm package @level-two/redis receives a total of 0 weekly downloads. As such, @level-two/redis popularity was classified as not popular.
We found that @level-two/redis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.