Installations
npm install @keyv/memcache
Developer Guide
Typescript
Yes
Module System
ESM
Score
95.1
Supply Chain
99.3
Quality
79.6
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Languages
TypeScript (99.12%)
CSS (0.37%)
Shell (0.36%)
JavaScript (0.16%)
Developer
Download Statistics
Total Downloads
6,880,824
Last Day
2,945
Last Week
113,440
Last Month
404,697
Last Year
4,019,417
GitHub Statistics
2,675 Stars
1,434 Commits
152 Forks
19 Watching
2 Branches
68 Contributors
Package Meta Information
Latest Version
2.0.1
Package Id
@keyv/memcache@2.0.1
Unpacked Size
16.73 kB
Size
4.81 kB
File Count
9
Publised On
21 Aug 2024
Total Downloads
Cumulative downloads
Total Downloads
6,880,824
Last day
-14.4%
2,945
Compared to previous day
Last week
14.9%
113,440
Compared to previous week
Last month
13.5%
404,697
Compared to previous month
Last year
48%
4,019,417
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
Dev Dependencies
7
@keyv/memcache
Memcache storage adapter for Keyv
Install
1npm install --save @keyv/memcache
or
yarn add @keyv/memcache
Usage
1import Keyv from 'keyv'; 2import KeyvMemcache from '@keyv/memcache'; 3 4const memcache = new KeyvMemcache('user:pass@localhost:11211'); 5const keyv = new Keyv({ store: memcache }); 6 7//set 8await keyv.set("foo","bar", 6000) //Expiring time is optional 9 10//get 11const obj = await keyv.get("foo"); 12 13//delete 14await keyv.delete("foo"); 15 16//clear 17await keyv.clear(); 18
Usage with Namespaces
1import Keyv from 'keyv'; 2import KeyvMemcache from '@keyv/memcache'; 3 4const memcache = new KeyvMemcache('user:pass@localhost:11211'); 5const keyv1 = new Keyv({ store: memcache, namespace: "namespace1" }); 6const keyv2 = new Keyv({ store: memcache, namespace: "namespace2" }); 7 8//set 9await keyv1.set("foo","bar1", 6000) //Expiring time is optional 10await keyv2.set("foo","bar2", 6000) //Expiring time is optional 11 12//get 13const obj1 = await keyv1.get("foo"); //will return bar1 14const obj2 = await keyv2.get("foo"); //will return bar2 15
Works with Memcached, Memcachier, Redislabs, and Google Cloud
Using Memcached
- Install Memcached and start an instance
1 2//set the server to the correct address and port 3const server = "localhost:11211" 4 5const Keyv = require("keyv"); 6const KeyvMemcache = require("@keyv/memcache"); 7 8const memcache = new KeyvMemcache(server); 9const keyv = new Keyv({ store: memcache});
Using Memcachier
- Go to https://www.memcachier.com and signup
- Create a cache and setup where.
- In the screen take the username, password, and url and place it into your code:
1 2//best practice is to not hard code your config in code. 3const user = ""; 4const pass = ""; 5const server = "XXX.XXX.XXX.memcachier.com:11211" 6 7const Keyv = require("keyv"); 8const KeyvMemcache = require("@keyv/memcache"); 9 10const memcache = new KeyvMemcache(user +":"+ pass +"@"+ server); 11const keyv = new Keyv({ store: memcache}); 12
Using Redislabs Memcache Protocol
- Go to https://www.redislabs.com and signup
- Create a database and make sure to set the
Protocol
to memcached - In the screen take the username, password, and
endpoint
(the server) and place it into your code:
1 2//best practice is to not hard code your config in code. 3const user = ""; 4const pass = ""; 5const server = "XXX.XXX.XXX.XXX.cloud.redislabs.com:XXX" 6 7const Keyv = require("keyv"); 8const KeyvMemcache = require("@keyv/memcache"); 9 10const memcache = new KeyvMemcache(user +":"+ pass +"@"+ server); 11const keyv = new Keyv({ store: memcache}); 12
Using Google Cloud
- Go to https://cloud.google.com/ and sign up.
- Go to the memcached configuration page in the google cloud console by navigating to Memorystore > Memcached.
- On the memcached page (Eg. https://console.cloud.google.com/memorystore/memcached/instances?project=example), Click Create Instance
- Fill in all mandatory fields as needed. You will need to set up a private service connection.
- To set up a private service connection, click the Set Up Connection button.
- Once required fields are complete, click the Create button to create the instance.
- Google provides further documentation for connecting to and managing your Memecached instance here.
1import Keyv from 'keyv'; 2import KeyvMemcache from '@keyv/memcache'; 3 4const memcache = new KeyvMemcache("insert the internal google memcached discovery endpoint"); 5const keyv = new Keyv({ store: memcache}); 6
License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
30 commit(s) and 24 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (23) are checked with a SAST tool
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Warn: no topLevel permission defined: .github/workflows/codecov.yaml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/deploy-website.yml:1
- Warn: no topLevel permission defined: .github/workflows/tests.yaml:1
- Info: no jobLevel write permissions found
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codecov.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codecov.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/codecov.yaml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codecov.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-website.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/deploy-website.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy-website.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/deploy-website.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy-website.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/deploy-website.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/tests.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/jaredwray/keyv/tests.yaml/main?enable=pin
- Warn: containerImage not pinned by hash: packages/postgres/Dockerfile.ssl:1: pin your Docker image by updating postgres:latest to postgres:latest@sha256:888402a8cd6075c5dc83a31f58287f13306c318eaad016661ed12e076f3e6341
- Warn: npmCommand not pinned by hash: .github/workflows/codecov.yaml:25
- Warn: npmCommand not pinned by hash: .github/workflows/deploy-website.yml:30
- Warn: npmCommand not pinned by hash: .github/workflows/tests.yaml:25
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 3 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
- Warn: branch protection not enabled for branch 'v4'
Score
5.8
/10
Last Scanned on 2024-12-23
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