Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
loopback-cache
Advanced tools
Cache solutions for Loopback.
npm install loopback-cache --save
To load the mixins.
# model-config.json
{
"_meta": {
...
"mixins": [
...
"loopback-cache/mixins",
...
]
},
...
}
To use the redis
backend, setup a model using the redis connector or the ioredis connector and use the mixin CacheModel
with the model. The TTL is in seconds, see http://redis.io/commands/expire.
# The model JSON
{
...
"mixins": {
"CacheModel": {
"backend": "redis",
"ttl": 3600
}
},
...
}
To use the couchbase
backend, setup a model using the couchbase3 connector and use the mixin CacheModel
with the model. The TTL is in seconds, for value larger than 30 * 24 * 60 * 60 seconds (30 days), it would be converted to absolute times (from the epoch) in seconds, see http://docs.couchbase.com/sdk-api/couchbase-node-client-2.1.2/Bucket.html#touch.
# The model JSON
{
...
"mixins": {
"CacheModel": {
"backend": "couchbase",
"ttl": 3600
}
},
...
}
Note: This module doesn't do anything on the DB or table level. For example MongoDB would require a special index that matches the field, which should be prepared before you start the application.
To add the support for a specific connector (it's a model mixin so we are talking connectors not DB directly), extend this module in a place that will be executed (for example boot
).
var loopbackCache = require('loopback-cache');
And add a new backend (you can also override backends). See https://github.com/Wiredcraft/loopback-cache/tree/master/backends for examples.
loopbackCache.backends.something = function(Model, options) {};
Now you can use it in the model JSON, same as any other backend.
{
"mixins": {
"CacheModel": {
"backend": "something",
"ttl": 3600
}
}
}
If you want to add a new backend to the module, just drop the file in the backends
directory, and send us a PR.
project : loopback-cache
repo age : 11 months
active : 16 days
commits : 46
files : 18
authors :
22 CCharlieLi 47.8%
22 Makara Wang 47.8%
2 fraserxu 4.3%
FAQs
Cache solutions for Loopback
The npm package loopback-cache receives a total of 10 weekly downloads. As such, loopback-cache popularity was classified as not popular.
We found that loopback-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.