Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@appolo/cache
Advanced tools
Cache module for appolo
.
Cache methods results using appolo-cache
with optional redis store
npm i @appolo/cache
key | Description | Type | Default |
---|---|---|---|
id | cacheProvider injector id | string | cacheProvider |
connection | redis connection string | string | `` |
memory | true to use memory store | boolean | true |
db | true to use redis store | boolean | false |
maxSize | max memory store items | number | 1000 |
keyPrefix | redis prefix key | string | c |
all option are optional and will be added as defaults to cache options in config/modules/all.ts
import {CacheModule} from '@appolo/cache';
export = async function (app: App) {
await app.module(new CacheModule({maxSize:100}));
// or with redis store
await app.module(new CacheModule({db:true,connection:"redis://redis-connection-string"}));
}
key | Description | Type | Default |
---|---|---|---|
id | custom cache id | string | className_methodName |
maxSize | max cache size | number | 1000 |
maxAge | set maximum age in ms of all cache items | number | unlimited |
clone | clone the cache result | boolean | false |
interval | set cache refresh interval in ms | number | undefined |
resolver | function to get the cache key by default the first argument will be used as the cache key. | function | undefined |
multi | if no resolver defined use all the arguments as key else use the first argument as key | boolean | false |
peek | use peek method instead of get | boolean | false |
refresh | refresh cache on half maxAge expire | boolean | false |
keyPrefix | redis prefix key | string | c |
memory | true to use memory store | boolean | true |
db | true to use redis store | boolean | false |
dbMaxAge | set maximum age in ms of all cache items in db if not defined maxAge will be used | number | unlimited |
import { cache,define } from 'appolo';
@define()
export class SomeClass {
private counter = 0;
@cache()
method() {
return ++this.counter
}
// will be refreshed every 5 sec
@cache({interval:5000})
async method2(key:string) {
let result = await doSomeThingAsync(key)
return result;
}
// will try to get items from memroy with expire
// of 1 minute then from redis with expire of one hour
@cache({db:true,maxAge:60*1000,:dbMaxAge:60*1000*60})
async method2(key:string) {
let result = await doSomeThingAsync(key)
return result;
}
}
createCache(options: ICacheOptions, valueFn: Function, scope?: any)
create new cache wrapper
getCacheById(id:string):Cache
return cache wrapper by id
cache wrapper instance
get<T>(...args: any[]): Promise<T> | T
get value from cache if not found the value fn will be called
get cache
return appolo-cache
instance
FAQs
appolo cache module
We found that @appolo/cache 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.