Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
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
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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.