
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@quikc/core
Advanced tools
@quikc/core - Core package for Quikc a NodeJS caching library@quikc/core is a Node.js caching library that supports multiple cache providers and pluggable lock providers. It is designed to be framework-agnostic and can be used in any Node.js application.
@quikc/core is not framwork specific and can be used in any Node.js application.
you can install it by running the following command:
npm install @quikc/core
# or
yarn add @quikc/core
You can use one of the following strategies:
memory - In-memory cachefs - File system cacheredis - Redis cacheFor the redis strategy, the cache provider utilizes ioredis under the hood. You can install it by running the following command:
npm install ioredis
# or
yarn add ioredis
You can use the memory cache provider by passing the memory strategy to the createStore function or by creating a new instance of the MemoryCacheProvider class.
import { createStore, MemoryCacheProvider } from '@quikc/core';
// Using the createStore function
const cache = createStore('memory');
// Using the MemoryCacheProvider class
const cache = new MemoryCacheProvider();
You can use the file system cache provider by passing the fs strategy to the createStore function or by creating a new instance of the FileSystemCacheProvider class.
import { createStore, FileSystemCacheProvider } from '@quikc/core';
// Using the createStore function
const cache = createStore('fs',{
// The path to the cache directory
cachePath: './cache'
});
// Using the FileSystemCacheProvider class
const cache = new FileSystemCacheProvider('./cache');
You can use the redis cache provider by passing the redis strategy to the createStore function or by creating a new instance of the RedisCacheProvider class.
import { createStore, RedisCacheProvider } from '@quikc/core';
import { Redis } from 'ioredis';
// Using the createStore function
const cache = createStore('redis',{
// The redis client instance
redisClient: new Redis({
host: 'localhost',
port: 6379
})
});
// Using the RedisCacheProvider class
const cache = new RedisCacheProvider(new Redis({
host: 'localhost',
port: 6379
}));
The cache instance exposes the following methods:
get(key: string): Promise<unknown | undefined> - Gets the cached value associated with the specified key.set(key: string, value: unknown, options?: CacheOptions): Promise<void> - Stores a value in the cache using the specified key.del(key: string): Promise<void> - Removes the cache entry associated with the specified key.clear(): Promise<void> - Clears all cached entries from the cache.getStats(): CacheStats - Retrieves cache statistics including hits, misses, and hit rate.setLockProvider(lockProvider: ILockProvider): void - Sets a lock provider to handle cache locking.getDependentKeys(key: string): Promise<string[] | undefined> - Gets the dependent keys for the specified key.delDependentKeys(keys: string[]): Promise<void> - Deletes the dependent keys for the specified key.CacheOptions is an interface that defines the options that can be passed to the set method of a cache provider. Here is the list of available options:
ttl: The time-to-live (TTL) for the cached value, in seconds.dependencies: An array of keys for other cached values that the current value depends on. If any of these dependent keys are deleted or updated, the current value will also be invalidated.priority: A number indicating the priority of the cached value, relative to other cached values. Higher-priority values will be retained in cache longer than lower-priority values, even if their TTLs have expired.lockTimeout: The maximum amount of time to wait for a lock when setting the cached value. If this timeout is exceeded, the set operation will fail.And the CacheEntry interface defines the structure of a cached value:
interface CacheEntry {
value: unknown;
expiresAt: number;
dependencies?: string[];
priority?: number;
locked?: number;
}
value: The value of the cache entry.expiresAt: The time at which the cache entry expires.dependencies: An optional array of cache entry dependencies.priority: An optional priority value for the cache entry.locked: An optional timeout value for acquiring a lock on the cache entry.Locks are used to prevent multiple concurrent writes to the same cache key, which can result in inconsistent or invalid cached data. Quikc supports pluggable lock providers that can be used to configure how locks are managed.
You can use the memory lock provider by passing the memory strategy to the createLock function or by creating a new instance of the MemoryLockProvider class.
import { createLock, MemoryLockProvider } from '@quikc/core';
// Using the createLock function
const lock = createLock('memory');
// Using the MemoryLockProvider class
const lock = new MemoryLockProvider();
You can use the redis lock provider by passing the redis strategy to the createLock function or by creating a new instance of the RedisLockProvider class.
import { createLock, RedisLockProvider } from '@quikc/core';
import { Redis } from 'ioredis';
// Using the createLock function
const lock = createLock('redis',{
// The redis client instance
redisClient: new Redis({
host: 'localhost',
port: 6379
})
});
// Using the RedisLockProvider class
const lock = new RedisLockProvider(new Redis({
host: 'localhost',
port: 6379
}));
You can use the file system lock provider by passing the fs strategy to the createLock function or by creating a new instance of the FileSystemLockProvider class.
import { createLock, FileSystemLockProvider } from '@quikc/core';
// Using the createLock function
const lock = createLock('fs',{
// The path to the lock directory
lockPath: './lock'
});
// Using the FileSystemLockProvider class
const lock = new FileSystemLockProvider('./lock');
The lock instance exposes the following methods:
acquireLock(key: string, timeout?: number): Promise<boolean>: Acquires a lock on the specified cache entry.releaseLock(key: string): Promise<void>: Releases the lock on the specified cache entry.clearLocks(): Promise<void>: Clears all locks. This method is intended for testing purposes only.getLock(key: string): Promise<boolean | undefined>: Returns a Promise that resolves to true if the lock is successfully acquired, or false otherwise.and you can use the setLockProvider method of the cache instance to set the lock provider:
import { createStore, createLock, MemoryCacheProvider, MemoryLockProvider } from '@quikc/core';
const cache = createStore('memory');
// Using the createLock function
const lock = createLock('memory');
// Using the MemoryLockProvider class
const lock = new MemoryLockProvider();
cache.setLockProvider(lock);
Contributions are welcome! Please read the contributing guide for more information.
FAQs
This package contains the core logic and interfaces for the caching library.
We found that @quikc/core 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.