Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "blackpink", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"version": "1.0.1", | ||
"description": "Simple redis utility function", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "tsc" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hmmhmmhm/blackpink.git" | ||
}, | ||
"keywords": [ | ||
"redis", | ||
"utility", | ||
"typescript", | ||
"node", | ||
"cache" | ||
], | ||
"author": "hmmhmmhm", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/hmmhmmhm/blackpink/issues" | ||
}, | ||
"homepage": "https://github.com/hmmhmmhm/blackpink#readme", | ||
"devDependencies": { | ||
"@types/redis": "^4.0.11" | ||
} | ||
} |
118
README.md
@@ -1,1 +0,117 @@ | ||
yea blackpink~ | ||
# 🦄 BLACKPINK | ||
> A Simple Redis Utility Function | ||
```bash | ||
npm install blackpink | ||
npm install redis | ||
``` | ||
# Check is newest list item | ||
> This function allows you to use Redis to check that the data is up to date. It also allows you to check the maximum number. | ||
```ts | ||
import * as redis from "redis"; | ||
import blackpink from "blackpink"; | ||
const client = redis.createClient({}); | ||
const pink = blackpink(client); | ||
void (async () => { | ||
const list = ["a1.png", "a2.png", "a3.png"]; | ||
let isFirstLoop = true; | ||
for (const item of list) { | ||
const isNewest = await pink.checkIsNewest({ | ||
list: "community-meme", | ||
item, | ||
isFirstLoop, | ||
limit: 300, | ||
}); | ||
if (isFirstLoop) isFirstLoop = false; | ||
if (isNewest) { | ||
console.log("new meme", item); | ||
break; | ||
} else { | ||
console.log("old meme", item); | ||
} | ||
} | ||
})(); | ||
``` | ||
# Cache single item | ||
```ts | ||
import * as redis from "redis"; | ||
import blackpink from ".blackpink"; | ||
const client = redis.createClient({}); | ||
const pink = blackpink(client); | ||
void (async () => { | ||
// Set cache | ||
await pink.setCache({ | ||
key: "test", | ||
value: "test", | ||
// 7days | ||
ttl: 60 * 60 * 24 * 7, | ||
}); | ||
// Get cache | ||
const data = await pink.getCache("test"); | ||
console.log(data); | ||
// Check cache hit | ||
const isHit = await pink.isCacheHit("test") | ||
console.log(isHit); | ||
// Invalidate cache | ||
await pink.invalidateCache("test"); | ||
})(); | ||
``` | ||
# Cache map item | ||
```ts | ||
import * as redis from "redis"; | ||
import blackpink from ".blackpink"; | ||
const client = redis.createClient({}); | ||
const pink = blackpink(client); | ||
void (async () => { | ||
// Set hash cache | ||
await pink.setHashCache({ | ||
key: "test", | ||
field: "test", | ||
value: "test", | ||
}); | ||
// Get hash cache | ||
const data = await pink.getHashCache({ | ||
key: "test", | ||
field: "test", | ||
}); | ||
// Check hash cache hit | ||
await pink.isHashCacheHit({ | ||
key: "test", | ||
field: "test", | ||
}); | ||
// Invalidate hash cache | ||
await pink.invalidateHashCache({ | ||
key: "test", | ||
field: "test", | ||
}); | ||
// Invalidate all hash cache | ||
await pink.invalidateAllHashCache("test"); | ||
})(); | ||
``` | ||
## License | ||
> MIT Licensed |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7026
5
104
0
0
117
0
0
1