Installations
npm install upcache
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
18.19.1
NPM Version
9.2.0
Score
73.1
Supply Chain
97
Quality
75.3
Maintenance
50
Vulnerability
98.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (83.95%)
Lua (13.41%)
Dockerfile (1.7%)
Makefile (0.93%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
kapouer
Download Statistics
Total Downloads
20,508
Last Day
2
Last Week
44
Last Month
152
Last Year
2,753
GitHub Statistics
15 Stars
432 Commits
1 Forks
2 Watching
1 Branches
1 Contributors
Bundle Size
96.90 kB
Minified
28.77 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.8.2
Package Id
upcache@2.8.2
Unpacked Size
108.89 kB
Size
24.61 kB
File Count
45
NPM Version
9.2.0
Node Version
18.19.1
Publised On
13 Apr 2024
Total Downloads
Cumulative downloads
Total Downloads
20,508
Last day
-66.7%
2
Compared to previous day
Last week
-12%
44
Compared to previous week
Last month
-23.2%
152
Compared to previous month
Last year
-16.9%
2,753
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
upcache
Caching proxy having cache keys configured by the upstream application, by setting http response headers.
Upcache has several ways of changing the cache keys:
- tag, version resources by zones
- lock, vary on client json web token grants
- vary, vary by grouping selected request headers
- map, maps a request uri to another request uri
Breaking change: server.d/upcache.conf is now server.d/upcache-memcached.conf
Requirements
In debian/12 these packages are easy to install:
-
nginx
-
libnginx-mod-http-srcache-filter
-
libnginx-mod-http-set-misc
-
libnginx-mod-http-memc (if using memcached, or for running the test suite
-
memcached or redis
-
lua-resty-core
-
lua-resty-lrucache
-
a Node.js express app
Install
The Node.js app need the module
1npm install upcache
The nginx configuration need the module
1luarocks install upcache
nginx is easily configured with the set of files described in (depending on
where npm installs the module) ./node_modules/upcache/nginx/README.md
.
Usage
Once installed, load appropriate helpers with
1const app = express(); 2const { tag, lock } = require('upcache'); 3const mlock = lock(config); 4 5app.get('/route', tag('ugc', 'global'), mlock.restrict('logged'), ...); 6app.post('/route', tag(), mlock.restrict('logged'), ...); 7
See README-tag.md and README-lock.md for documentation, and test/ for more examples.
Mind that srcache
module honours cache control headers - if the application
sends responses with Cache-Control: max-age=0
, the resource is not cached,
and tag().for()
is a facility for doing cache control.
To cache something, resources must be tagged, so lock/vary won't work without tag.
Detection by upstream
Upcache adds a X-Upcache: <version>
header to requests, so upstream application
can detect it is enabled, and which features are available.
Testing
A pre-configured nginx environment is available for testing a Node.js application that listens on port 3000, with nginx on port 3001 and memcached on port 3002, simply by launching (depending on ./node_modules/.bin being on PATH or not)
1npm run upcache
which also has an option for filtering output -g <regexp pattern>
.
mocha
relies on it for integration tests. No root permissions are needed.
License
See LICENSE file.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: containerImage not pinned by hash: Dockerfile:11: pin your Docker image by updating debian:stretch-slim to debian:stretch-slim@sha256:abaa313c7e1dfe16069a1a42fa254014780f165d4fd084844602edbe29915e70
- Warn: npmCommand not pinned by hash: Dockerfile:47
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Score
2.8
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More